On Thu, Dec 10, 2009 at 11:14:32AM -0800, Scott Hess wrote:
> On Thu, Dec 10, 2009 at 10:58 AM, Peter Kasting <[email protected]> wrote:
> > On Thu, Dec 10, 2009 at 10:45 AM, Jonathan Dixon <[email protected]> wrote:
> >> In essence:
> >> return DoWork(&foo)
> >> #if defined(OS_POSIX)
> >>     && DoWork(&posix_specific)
> >> #endif
> >>     ;  // <-- Lint complains about this guy
> >
> > I'd prefer this:
> > #if defined(OS_POSIX)
> >   return DoWork(&foo) && DoWork(&posix_specific);
> > #else
> >   return DoWork(&foo);
> > #endif
> > The same number of lines, but much easier to read.
> 
> 
> Or:
>  bool ret = DoWork(&foo);
> #if defined(OS_POSIX)
>  ret = ret && DoWork(&posix_specific);
> #endif
>  return ret;
> 
> Breaking a single statement up with a macro is icky.

If something extra in an expression is a common case, I've sometimes
seen it done like:
    return DoWork(&foo) POSIX_ONLY(&& DoWork(&posix_specific));
where POSIX_ONLY will expand to nothing or its argument.
It's ugly, but compact.

      -- Jacob

-- 
Chromium Developers mailing list: [email protected] 
View archives, change email options, or unsubscribe: 
    http://groups.google.com/group/chromium-dev

Reply via email to