const void* and goto *expr

Igor Bukanov igor@mir2.org
Tue Jun 24 21:34:00 GMT 2008


2008/6/24 Dan Hipschman <dsh@linux.ucla.edu>:
>
> You are probably correct to say that goto should accept an expression of
> type "const void *", since it shouldn't modify the value at the address.

But this is what GCC does already as the example demonstrates: it
accepts const void* as the type of exp in "goto *exp" in addition to
plain void*. This is both with gcc and g++. The question is this
intended behavior? If the answer is yes, then the documentation has a
bug. If the answer is no, then this is a bug in GCC.

The issue came up when compiling with the Intel compiler a code with
computed code that used const void*. GCC was dealing with that code
just fine but icc insisted that the type should be void*. I guess
Intel folks just followed documentation when implemented the
computed-goto in their compiler.

Regards, Igor



More information about the Gcc-help mailing list