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

Geoff Keating geoffk@geoffk.org
Thu May 3 03:41:00 GMT 2001


Nathan Sidwell <nathan@codesourcery.com> writes:

> 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

This is not necessarily true.  In C89 _the programmer_ cannot define
variadic macros, but the system headers aren't restricted by that.

-- 
- Geoffrey Keating <geoffk@geoffk.org>



More information about the Gcc-bugs mailing list