Re: alias question

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

 



>> But not every type aliases character type!
>
> What?  You can access any type with a char type,
> this is a specific exception.

Yes.  And you cannot access a char as any type.  The exception is
not symmetric in that way.

> Here's a concrete example.

> const short *w((short*)b);

That's not C code.  I have no idea about the rules in C++..

> char b[4] = {0,0,0,0};

If it was C, then the objects b[...] have declared type "char", so
you are only allowed to access it as a character type; anything
else results in  undefined behaviour.


Segher



[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