GCC's statement expression extension

Jamie Lokier egcs@tantalophile.demon.co.uk
Sat Jul 29 14:36:00 GMT 2000


Per Bothner wrote:
> One use I've found for statement-expressions...

Another use I've found is when you want a local label in a big macro.
This is because the __label__ extension works only in statement
expressions.  So I've seen:

  #define foo(a1,a2) \
    do ({ __label__ l1, l2, l3; /* code... */; }) while(0)

Why doesn't __label__ work inside an ordinary statement block?

-- Jamie


More information about the Gcc mailing list