Re: const void* and goto *expr

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

 



On Tue, Jun 24, 2008 at 10:13:24PM +0200, Igor Bukanov wrote:
> 
> 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;
> }

The && operator yields an object of type "void *", which is what you get
if you print the name with typeid.  It should be fine to assign this to
a variable of type "const void *" since "const void *" is a supertype of
"void *".

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.

[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