<<< Date Index >>>     <<< Thread Index >>>

Re: Little code cleanup



On 2008-03-07 18:05:17 +0000, David Laight wrote:
> On Fri, Mar 07, 2008 at 03:59:30PM +0100, Vincent Lefevre wrote:
> > -# define NONULL(x) x?x:""
> > +# define NONULL(x) ((x) != (void *) 0) ? (x) : ""

Oops, I added the closing parenthesis at the wrong place. It should
of course be:

  #define NONULL(x) ((x) != (void *) 0 ? (x) : "")

> Both those definitions are absolutely horrid:
> Consider:
>     *NONULL(foo)
>     1 + NONULL(foo) + 1
>     NONULL(a == b ? c : d)

There should no longer be any syntax problem with the fixed definition.

-- 
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / Arenaire project (LIP, ENS-Lyon)