[Top][All Lists]
[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
- FYI, recent gcc vs. glibc's `#define printf(...' vs texinfo-4.0b, Jim Meyering, 2001/05/02
- Re: FYI, recent gcc vs. glibc's `#define printf(...' vs texinfo-4.0b, Ben Collins, 2001/05/02
- Re: FYI, recent gcc vs. glibc's `#define printf(...' vs texinfo-4.0b, Neil Booth, 2001/05/02
- Re: FYI, recent gcc vs. glibc's `#define printf(...' vs texinfo-4.0b, Zack Weinberg, 2001/05/02
- Re: FYI, recent gcc vs. glibc's `#define printf(...' vs texinfo-4.0b, Alexandre Oliva, 2001/05/02
- Re: FYI, recent gcc vs. glibc's `#define printf(...' vs texinfo-4.0b,
Nathan Sidwell <=