On Mon, Sep 17, 2007 at 10:44:49AM +0200, Abdelrazak Younes wrote:
> Jean-Marc Lasgouttes wrote:
> >[EMAIL PROTECTED] writes:
> >>            bool dummy = conv.To->dummy() && conv.to != "program";
> >>-           if (!dummy)
> >>+           if (!dummy) {
> >>                    LYXERR(Debug::FILES) << "Converting from  "
> >>                           << conv.from << " to " << conv.to << endl;
> >>+           }
> >>            infile = outfile;
> >
> >So the code is like
> >
> >   if (!dummy)
> >      if (!lyxerr.debugging(Debug::FILES)) ; else lyxerr << "Converting 
> >      from  "
> >                            << conv.from << " to " << conv.to << endl;
> >
> >Isn't there some documented trick that avoids this warning? Having to
> >add braces around the second if is not nice.
> 
> What about enclosing the macro with {}?

No good idea. The current macro requires an "open end" that can have
"<<" attached.

Even if it weren't: Just try to compile:

        if (...)
                {...};
        else
                ...


If LYXERR usage would  be something like

                LYXERR(Debug::FILES, "Converting from  "
                       << conv.from << " to " << conv.to << endl);

we could have

#define LYXERR(type, what) \
        do { if (!lyx::lyxerr.debugging(type)) ; else lyx::lyxerr << what; } \
        while (0)

(and we could even include the endl in the macro, we use it anyway in
all cases)

But last time I proposed to use the two-argument version the proposal
was shot down because people consider the << version more stylish. 

Andre'

Reply via email to