[Freeciv-Dev] (PR#6223) improved die()
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
[per - Mon Sep 22 04:59:48 2003]:
> On Sun, 21 Sep 2003, Jason Short wrote:
> > > This improves the die() call so that file and line where die() was
> called
> > > is printed on exit. This is very useful for debugging and bug
> reports. I
> > > hope the use of variadic macros is portable. I think they are C99
> safe, at
> > > least.
> >
> > This ... functionality in a macro is not standard C.See freelog()
> for
> > how to do it for gcc only.
>
> Is too.
I think what Jason is refering to is this: (in log.h)
#ifdef __GNUC__
#define freelog(level, args...) do { \
.
.
.
#else
/* non-GCC: */
static void freelog(int level, const char *message, ...)
{
.
.
.
}
#endif /* __GNUC__ */
If variadic macros are available for more than just GCC, then that
probably should be a different define up top, say __C99__ or even
__VARIADIC__ (which could be defined in shared.h in a "#ifdef
GCC/#define __VARIADIC__ /#endif block).
(BTW, isn't it bad form to have function definitions in a .h file?
Would moving void freelog(){} to log.c and wrapping it a "#ifndef
freelog()" work?)
--
++JohnWheeler
|
|