Re: glib.h: defining functions in header file




On Wed, 30 Jun 1999, Tim Janik wrote:

> if you just want to use the macros, you are probably better off simply
> copying them.

:-( to me that seems more kludgy than putting "#define g_logv(a,b,c,d)"
before including glib.h.

> the function implementations are not there because we wanted to practice
> bad programming, but because there is no way to slide in a library-specifc
> preprocessor symbol (G_LOG_DOMAIN) into a normal function call, or to
> write macros with variable argument lists in ANSI C (i.e. with non-gcc
> compilers).

ah. I see. by "library-specific" you mean machine/architecture dependent?
are "library-specific" preprocessor symbols always kept out of the library
code?

Is it a goal of Glib to have it function properly even if you use a
different compiler to configure and build glib than you do to compile a
program using it? I have noticed for at least one case this does not work:
if glib is configured with gcc, it will have G_HAVE_INLINE defined even if
__cplusplus is not defined. however, if you then try to compile a program
which uses glib with SUNWspro4.2 cc, glib.h will break because it will
declare functions as "inline".

If this is not one of glib's goals, what is the reasoning for keeping
library-specific macros out of the library code?

thanks,
--matt



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