Ar an t-aonú lá déag de mí Lúnasa, scríobh Jerry James:
> I agree that it’s right; I do wonder why you’re not using
vararg
> versions of those macros, since anyone living on the edge enough to
> play with XFT support certainly has a compiler that supports them, they
> are cleaner, and my patch of 2005-01-17 used them, so it’s not for want
> of knowing about them.
Variadic macros can only be compiled by C99 compilers or (using a
different form of writing such macros) pre-C99 gcc. I'd like to use
them myself; they simplify horrible stuff like the many definitions in
lisp.h that end in _1, and _2, and _3, and ...
However, so far as I know, we are still committed to supporting systems
that have C89 non-gcc compilers, are we not?
But not to developing on them. Something like the below uses variadic macros
for debug output if they are available, otherwise generates legal C89 but no
debug output. I will be shocked if someone compiling with fontconfig support
and in need of debug output doesn’t have a compiler that can handle variadic
macros.
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901)
#ifdef DEBUG_XEMACS
#define DEBUG_XFT(level, format, ...) do { \
if (debug_xft > level) \
{ \
stderr_out(format, __VA_ARGS__); \
} \
} while (0)
#else /* DEBUG_XEMACS */
#define DEBUG_XFT(level, format, ...)
#endif /* DEBUG_XEMACS */
#elif defined(__GNUC__)
#ifdef DEBUG_XEMACS
#define DEBUG_XFT(level, format, args...) do { \
if (debug_xft > level) \
{ \
stderr_out(format, args); \
} \
} while (0)
#else /* DEBUG_XEMACS */
#define DEBUG_XFT(level, format, args...)
#endif /* DEBUG_XEMACS */
#else /* defined(__STDC_VERSION__) [...] */
#define DEBUG_XFT (void *)
#endif
--
Santa Maradona, priez pour moi!