bug-glibc
[Top][All Lists]
Advanced

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

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


From: Nathan Sidwell
Subject: Re: FYI, recent gcc vs. glibc's `#define printf(...' vs texinfo-4.0b
Date: Thu, 03 May 2001 09:02:36 +0100

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?'
address@hidden : http://www.cs.bris.ac.uk/~nathan/ : address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]