[MPlayer-dev-eng] Correctly Printing FOURCCs
D Richard Felker III
dalias at aerifal.cx
Thu Feb 28 19:00:32 CET 2002
On Thu, Feb 28, 2002 at 11:17:39AM -0500, D Richard Felker III wrote:
> On Thu, Feb 28, 2002 at 04:38:04PM +0100, Arpi wrote:
> > Hi,
> >
> > > > printf ("fourcc: %.4s", (char *)&fourcc);
> > > > prints the FOURCC backwards on big endian systems ('MARC' instead of
> > > > 'CRAM', ' war' instead of 'raw '). I wanted to make a macro that will
> > > > break it down into 4 printable chars, like so:
> > > > printf ("fourcc: %c%c%c%c", FOURCC_PRINTF_PARMS(fourcc));
> >
> > 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.
>
> Both gcc and glibc seem to have a lot of such brain damage (see the
> string macros in bits/string.h) which breaks lots of perfectly
> legitimate code such as prototypes for standard functions outside of
> headers. IMO the correct approach is to complain repeatedly and loudly
> to the idiots making this brain damaged stuff, so that it gets fixed,
> rather that letting gcc/glibc turn into an even bigger mess of
> standards abuse than it already is.
Make that bits/string2.h. The stuff in bits/string.h is probably just
as broken but at least it's disabled by default. Personally i
recommend typing "> /usr/include/bits/string2.h" at the shell to fix
glibc systems... :)
Rich
More information about the MPlayer-dev-eng
mailing list