lynx-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: lynx-dev Re: LYNX-DEV lynx_w32.zip feedback


From: pg
Subject: Re: lynx-dev Re: LYNX-DEV lynx_w32.zip feedback
Date: Wed, 15 Apr 1998 12:29:46 -0600 (MDT)

In a recent note, T.E.Dickey said:

> Date: Wed, 15 Apr 1998 12:28:42 -0400 (EDT)
> 
> > > We could work around that by making the macro have the if statement 
> > > the way it does now: 
> > >   #define DPRINTF(p) if (TRACE) dprintf p 
> > >  
> > Or, should it be: 
> >  
> > >       #define DPRINTF(p) { if (TRACE) dprintf p; } 
> >  
> > to avoid dangling-else problems?  The syntax of C leaves no proper way 
> > to do this. 
> well, if I put the if inside the function we don't have to worry about
> the compilers that don't like the curly braces either.
>   
Perhaps safest is:

            #define DPRINTF(p) ( TRACE &&   dprintf p  ) 

Which avoids braces, encapsulates with parentheses (always recommended
for macro definitions), and avoids the "open if" problem in section
"Preprocessor 2.3" of Alan R. Feuer's "C Puzzle Book".

-- gil

reply via email to

[Prev in Thread] Current Thread [Next in Thread]