This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: FYI, recent gcc vs. glibc's `#define printf(...' vs texinfo-4.0b
- To: Alexandre Oliva <aoliva at redhat dot com>
- Subject: Re: FYI, recent gcc vs. glibc's `#define printf(...' vs texinfo-4.0b
- From: Nathan Sidwell <nathan at codesourcery dot com>
- Date: Thu, 03 May 2001 09:02:36 +0100
- CC: Jim Meyering <jim at meyering dot net>, Karl Berry <karl at freefriends dot org>, bug-gcc at gnu dot org, bug-glibc at gnu dot org
- Organization: Codesourcery LLC
- References: <urypudrk7lb.fsf@ixi.eng.ascend.com> <orn18vgyfb.fsf@guarana.lsd.ic.unicamp.br>
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