|
From: | Anthony Liguori |
Subject: | Re: [Qemu-devel] Re: [PATCH 1/5] HACKING: add preprocessor rules |
Date: | Mon, 16 Aug 2010 13:32:31 -0500 |
User-agent: | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.11) Gecko/20100713 Lightning/1.0b1 Thunderbird/3.0.6 |
On 08/16/2010 01:05 PM, Blue Swirl wrote:
On Sun, Aug 15, 2010 at 9:27 PM, Andreas Schwab<address@hidden> wrote:Blue Swirl<address@hidden> writes:+For variadic macros, stick with C99 syntax: + +#define DPRINTF(fmt, ...) \ + do { printf("IRQ: " fmt, ## __VA_ARGS__); } while (0)That's not C99 syntax, the combination with ## is a gcc extension. In C99 you cannot have an empty __VA_ARGS__.That's too bad, I picked the example from one of our current macros. Maybe just s/C99/this/ or perhaps we shouldn't specify any non-standard syntax.
We definitely should discourage the GCC syntax [#define fn(arg...)] as it's deprecated by the new C99 syntax. Very specifically, only the '##' is an extension and it's a widely adopted one.
Regards, Anthony Liguori
[Prev in Thread] | Current Thread | [Next in Thread] |