Re: GType typedef API/ABI break.



On Fri, 22 Jun 2007, Murray Cumming wrote:

On Fri, 2007-06-22 at 10:05 +0200, Tim Janik wrote:
On Fri, 22 Jun 2007, Murray Cumming wrote:

For instance, glibmm's library contains a
 void get_defs(unsigned long)
But now, when building gtkmm, the linker is looking for
 void get_defs(unsigned int)
and failing.

hm, just to clarify explicitely, actual C ABI wasn't broken by
this change.

I think that's debatable. I'd prefer to be careful than have to argue
over every possible thing this could break.

 i guess we can workaround the C++ linking issues
by reintroducing
   typedef gulong GType;
if GLIB_SIZEOF_LONG == GLIB_SIZEOF_SIZE_T && defined __cplusplus.
that'll just leave C++ with bogus warnings about %zu again.

I really don't like the idea of a typedef having one definition for C
and another for C++.

well, we've always had two definitions there (using long, allthough
the effective GType width was always made sure to match
GLIB_SIZEOF_SIZE_T).

It seems destined to break something sometime in
strange and obscure ways.

aparently, at least for C++ (which of course wasn't intended by
the change).

What does %zu do? What bug does this solve?

printf-ing a GType. so far, the "correct" way to print it would
have been to use %lu if GLIB_SIZEOF_LONG == GLIB_SIZEOF_SIZE_T,
and %zu (prints size_t) otherwise, allthough sizeof (GType) is
guaranteed to always match sizeof (size_t) (not neccessarily
sizeof (long)).

--
Murray Cumming

---
ciaoTJ



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]