[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Unhealthy commit e3340714c8 Style: clarify "do nothing" macro with {
From: |
David Kastrup |
Subject: |
Re: Unhealthy commit e3340714c8 Style: clarify "do nothing" macro with {}; |
Date: |
Sat, 09 Oct 2010 21:49:35 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) |
Graham Percival <address@hidden> writes:
> On Fri, Oct 8, 2010 at 6:35 AM, David Kastrup <address@hidden> wrote:
>> Graham Percival <address@hidden> writes:
>>> in that the macro might look like a single statement, but it gets
>>> expanded into two. (is it worth enclosing the non-else definition
>>> with a { } to avoid this?)
>>
>> "{ ... }" is not sufficient since that already is a complete statement
>> without adding a semicolon, unlike a function call.
>>
>> The wrapper needs to be "do { ... } while (0)". It is an idiom that
>> compilers optimize away.
>
> Ok, how's this patch?
Looks good.
--
David Kastrup