This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: FYI, recent gcc vs. glibc's `#define printf(...' vs texinfo-4.0b


Alexandre Oliva wrote:

> The problem is in the program that assumes any C standard function is
> not implemented as a macro.  The C Standard explicitly allows a number
> of functions to be implemented as preprocessor macros, and it doesn't
> allow preprocessor directives within macro expansions.
We have a problem here.
printf is a varadic function
in C89 there are no varadic macros
ergo, a programmer might reasonably deduce printf cannot be a macro

can the glibc behaviour be gated on STDC_VERSION?
#if !__STDC__ || __STDC_VERSION__ >= 199909 /* or whatever the right number is */
#define printf(format, ...) (fprintf (stdout, format, __VA_ARGS__))
#endif

in C99 the case is different of course.

nathan

-- 
Dr Nathan Sidwell   ::   http://www.codesourcery.com   ::   CodeSourcery LLC
         'But that's a lie.' - 'Yes it is. What's your point?'
nathan@codesourcery.com : http://www.cs.bris.ac.uk/~nathan/ : nathan@acm.org


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]