const void* and goto *expr

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

 



The documentation for GCC states in
http://gcc.gnu.org/onlinedocs/gcc-4.3.0/gcc/Labels-as-Values.html#Labels-as-Values
:

You can get the address of a label defined in the current function (or
a containing function) with the unary operator `&&'. The value has
type void *.

Yet apparently, as the following program demonstrates, using const
void* as the type of the label-as-value is fine both with gcc and g++:

~/s $ cat x.c
const void * f()
{
    const void *p;

    p = &&label;
    goto *p;
  label:
    return p;
}
~/s $ gcc -c -Wall -Wextra x.c
~/s $ g++ -c -Wall -Wextra x.c
~/s $ gcc --version
gcc (GCC) 4.3.0 20080428 (Red Hat 4.3.0-8)

So what is exactly the type of &&label expression and what goto *expr
accepts as a type of expr?

Regards, Igor

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux