There are cases where you'll want to flout the linter, but this isn't
one of them.  Scott and Peter have both posted viable workarounds that
don't hamper readability (and in fact improve it relative to the
snippet Jonathan is asking about.)  Personally, I prefer Scott's, but
Peter's is good too.

Don't do what Jacob proposed in this case: it's a net a readability
loss because the pattern is unfamiliar.  (Sorry, Jacob!)

Mark

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.
>
> -scott
>
> --
> Chromium Developers mailing list: [email protected]
> View archives, change email options, or unsubscribe:
>    http://groups.google.com/group/chromium-dev
>

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

Reply via email to