Re: glib/gmessages.h on platforms without ISO/GNU varargs



On Oct 11, 2004, at 10:29 AM, Albert Chin wrote:

The Sun C compiler on Solaris 2.5.1 does not support ISO/GNU varargs.
Therefore, when <glib/gmessages.h> is pulled in from <glib.h>, it
forces the caller to link in -lglib for g_logv() because:
the pure macro versions are just wrappers around g_log(), so even just 
using those requires linking with -lglib.

  ...
  #else   /* no varargs macros */
  static void
  g_error (const gchar *format,
           ...)
  {
    va_list args;
    va_start (args, format);
    g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, format, args);
    va_end (args);
  }
  ...

Is there a reason we don't list only the function prototypes and move
the functions to gmessages.c?
it wouldn't work.  G_LOG_DOMAIN and G_LOG_LEVEL_ERROR are macros that 
are to be evaluated by the calling code; if you put only the prototype 
in the header, you'd still have to macro-ize it somehow to get those to 
show up.  this declaration gives you a private version of the function, 
with the local values of those macros, in each module that uses it 
(uses more space, but that's the penalty for a crappy compiler :-).

--
"that's it! you're a genius!" "yes. that's what i think. do you think i deserve a raise?"
	- dialogue from 'Godzilla versus Mothra', 1964




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