This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

const void* and goto *expr


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 Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]