[MPlayer-dev-eng] Correctly Printing FOURCCs
Fredrik Kuivinen
freku045 at student.liu.se
Sat Mar 2 01:39:17 CET 2002
On Fri, Mar 01, 2002 at 03:17:05PM -0500, D Richard Felker III wrote:
> On Fri, Mar 01, 2002 at 03:42:45PM +0100, Falk Hueffner wrote:
> > D Richard Felker III <dalias at aerifal.cx> writes:
> >
> > > > ahh, and someone should test this with gcc 3.x first.
> > > > as it handles printf as macro, weird things used to happen when we use
> > > > tricky macros or #if together with printf :(
> > >
> > > Then gcc 3.x is broken. Last I checked the C standard does not
> > > specify that printf can be a macro.
> >
> > Check again, it does.
>
> That's not possible, since printf *cannot* be implemented as a macro
> in standard C. It requires compiler extensions which allow macros to
> take a variable number of arguments.
>
C99 have varargs macros in the standard. This quoute from
http://www.ucalgary.ca/~bgwong/n869.pdf which seems to be the C99 standard
is relevant to this discussion. In page 176 section 7.1.4:
Any function declared in a header may be additionally implemented as a
function-like macro defined in the header, so if a library function is
declared explicitly when its header is included, one of the techniques
shown below can be used to ensure the declaration is not affected by
such a macro.
So glibc define printf as a macro and it is nothing wrong with doing that.
/ Fredrik Kuivinen
More information about the MPlayer-dev-eng
mailing list