The C and C++ standards do not support this feature.
However, the GNU Compiler Collection (GCC) includes a non-standard extension for doing this, as described in the Labels as Values section of the Using the GNU Compiler Collection manual.
Essentially, they have added a special unary operator &&
that reports the address of the label as type void *
. See the article for details. With that extension, you could just use &&
instead of &
in your example, and it would work on GCC.
P.S. I know you don’t want me to say it, but I’ll say it anyway… DON’T DO THAT!!!