[XviD-devel] Re: [INFO] dev-api-3 merged into CVS_HEAD

Felix von Leitner felix-xvid at fefe.de
Mon Feb 17 12:17:36 CET 2003


Thus spake suxen_drol (suxen_drol at hotmail.com):
> * the linux DPRINTF has been macro. though it is wrapped in a while(0)
> loop, which is rather odd. anyone know why?

Well, we have to put it in { } to remove else ambiguities outside the
macro.  Now consider this macro:

#define foo(x) { bar(x) }

and this code:

  foo(3); /* works */
  if (predicate())
    foo(17); /* does not work, because the ; terminates the whole if */
  else
    foo(23);

That's why it has to be wrapped with the "do { ... } while (0);"



More information about the XviD-devel mailing list