[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: |
Graham Percival |
Subject: |
Re: Unhealthy commit e3340714c8 Style: clarify "do nothing" macro with {}; |
Date: |
Sat, 9 Oct 2010 20:09:23 +0100 |
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?
Cheers,
- Graham
0001-Make-ASSERT_LIVE_IS_ALLOWED-behave-as-a-function.patch
Description: Text Data