Re: ## issue with glib.h



on 8/9/00 1:57 PM, Raja R Harinath at harinath@cs.umn.edu wrote:

> One instance that I fixed it was in ORBit/src/IIOP/iiop-encoders.h

I fixed that same problem on the stable branch (you only did HEAD) and a
similar problem elsewhere in ORBit.

> Deprecated GCC way (used in glib.h):
> #define g_message(format, args...) g_log(DOM, LOG_LEV, format, ##args)
> 
> ISO C 1999 way:
> #define g_message(format_args...) g_log(DOM, LOG_LEV, format_args)
> 
> The problem the '##' solves in the first (deprecated) style is when
> args is empty -- in which case it swallows the preceding ',', IOW
> it allows g_message("abc") rather than forcing g_message("abc",).
> 
> The second style is supported in GCC too (well, I checked GCC
> 2.7.2.3, and it worked).  So, we should probably just move to that,
> and maybe relax the #ifdef to include ISO C99.

Great news! We should definitely move to the new syntax to avoid the warning
with the new picker version of GCC.

I'd like to see this fix even on the stable branch. The only issue I can
think of is the desire to support older versions of GCC. Relaxing the ifdef
to accommodate non-GCC C99 compilers seems like something optional that can
wait, maybe until we actually encounter one of those compilers.

Owen, Tim, should I create a patch, or is this discussion sufficient?

    -- Darin





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