Re: macros: "do-while" versus "({ })" and a compile-time error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Robert P. J. Day wrote:
>   just to stir the pot a bit regarding the discussion of the two
> different ways to define macros,

You mean function-like macros, right?

> i've just noticed that the "({ })"
> notation is not universally acceptable.  i've seen examples where
> using that notation causes gcc to produce:
> 
>   error: braced-group within expression allowed only inside a function

And function calls and macros which expand to "do { expr; } while (0)"
won't work anywhere outside of functions either.

> i wasn't aware that there were limits on this notation.  can someone
> clarify this?  under what circumstances *can't* you use that notation?
> thanks.

The limitations are certainly highly compiler-specific.
-- 
Stefan Richter
-=====-=-=== ---= -=--=
http://arcgraph.de/sr/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux