Re: inline and glib.h (was Re: ObjC and `glib.h')



Tim Janik <timj@gtk.org> writes:

> > #      define inline /* don't inline, then */	<---- potential trouble here
>          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 
> how would that cause problems for a compiler that doesn't understand
> "inline" at all?

It wouldn't, I didn't make myself clear, sorry. The C compiler is not
the problem, a C++ compiler is, though.

> > It seems trouble would occur if glib is configured for a C compiler
> > which absolutely does not understand "inline", and glib.h is included
> > from C++.
> 
> hm, could you extend on what the trouble actually is and provide a test
> case (including information about the system and the C/C++ compiler
> you are running)?

Suppose your C compiler does not understand 'inline'. glib.h is
configured to #define 'inline' away. If you happen to include glib.h
with such a configuration from C++, where 'inline' is standard, you're
in trouble. Tero and some Gtk-- users ran into this problem recently,
due to an old glibconfig.h lying in the wrong place.

I suppose adding

#ifdef __cplusplus
#define G_HAVE___INLINE 1
#define G_HAVE___INLINE__ 1
#define G_HAVE_INLINE 1
#endif

would do the trick...

BTW, why are g_error(), g_message() and g_warning() defined with a
plain 'inline', like this :

static inline void
g_error (const gchar *format,
	 ...)

while everywhere else in glib.h, G_INLINE_FUNC is used ?

-- 
					Guillaume.
					http://www.worldnet.fr/~glaurent



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