[MPlayer-dev-eng] cleanups of a few macros in Gui/

pl p_l at gmx.fr
Mon Oct 8 17:49:14 CEST 2001


Hi,

On Mon, Oct 08, 2001 at 05:04:12PM +0200, Arpi wrote:
> > -#define IZE(x) printf("@@@ " x " @@@\n");
> > +#define IZE(x) do { printf("@@@ " x " @@@\n"); } while(0)
or remove the ';' in the orig #define
[...]
> >  #define CHECKDEFLIST( str ) \
> > -{ \
> > +do { \
> >   if ( defList == NULL ) \
> >    { \
> > -   message( False,MSGTR_SKIN_WARNING1,linenumber,str ); \
> > +   message( False,MSGTR_SKIN_WARNING1,linenumber,(str) ); \
> >     return 1; \
> >    } \
> > -}
> strange again. why isn't enough the simple { } ?

	if (flag)
		CHECKDEFLIST("foo?");
	else
		func();

will expand to

	if (flag)
		{ }
		 ;
	else
		func();

will probably cause an error at compile time (as well as IZE(X) I
guess).  (http://www.geocrawler.com/archives/3/357/1998/5/0/1976243/ for
instance)

As said in my previous post it's no big deal since gcc will spot it, but
it's a standard way to define macros (your linux kernel headers are full
of such things :)

--
Regards,
  pl



More information about the MPlayer-dev-eng mailing list