On Wed, Jan 3, 2018 at 3:59 PM, Damien Miller <[email protected]> wrote:
> On Thu, 4 Jan 2018, David Gwynne wrote:
>
> > my theory is that __statement (a gcc extension) was used to allow
> > macros to evaluate their argument(s) once by assigning it to a local
> > variable, and then returning a value. this is difficult with normal
> > macros.
>
> Not understanding - doesn't this:
>
> > -#define __swap32md(x) __statement({
> \
> > - __uint32_t __swap32md_x = (x); \
>
> evaluate its argument only once even without __statement?
>
The extension is the "({ ... })" syntax, not the __statement token. The
latter is only there to suppress "you're using an extension!!!11!!"
warnings.
Without using the gcc ({ ... }) extension, how are you going to create a
scope for a local variable in the middle of an expression?
Philip Guenther