[MPlayer-dev-eng] Correctly Printing FOURCCs

D Richard Felker III dalias at aerifal.cx
Sat Mar 2 04:01:04 CET 2002


On Sat, Mar 02, 2002 at 01:39:17AM +0100, Fredrik Kuivinen wrote:
> 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.

Bleh, I hate C99. Tons of stupidities and C++-like crap. Give me good
'ol ANSI C...

Rich




More information about the MPlayer-dev-eng mailing list