From: "Segher Boessenkool" <segher@kernel.crashing.org>
To: "xorbe" <xorbe@yahoo.com>
Cc: gcc-help@gcc.gnu.org
Subject: Re: alias question
Date: Sat, 19 Feb 2011 09:41:00 -0000 [thread overview]
Message-ID: <56330.94.211.195.167.1298053891.squirrel@gate.crashing.org> (raw)
In-Reply-To: <34841.78061.qm@web130223.mail.mud.yahoo.com>
>> 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
next prev parent reply other threads:[~2011-02-18 18:31 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-18 18:31 xorbe
2011-02-19 9:41 ` Segher Boessenkool [this message]
2011-02-19 19:01 ` xorbe
2011-02-23 1:30 ` Patrick Horgan
2011-02-23 1:31 ` Patrick Horgan
-- strict thread matches above, loose matches on Subject: below --
2011-02-18 2:03 xorbe
2011-02-18 4:25 ` Segher Boessenkool
2011-02-18 10:02 ` Andrew Haley
2011-02-18 13:30 ` Segher Boessenkool
2011-02-18 13:45 ` Andrew Haley
2011-02-18 14:31 ` Segher Boessenkool
2011-02-18 14:44 ` Andrew Haley
2011-02-18 15:00 ` Segher Boessenkool
2011-02-18 10:32 ` xorbe
2011-02-18 10:40 ` Andrew Haley
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=56330.94.211.195.167.1298053891.squirrel@gate.crashing.org \
--to=segher@kernel.crashing.org \
--cc=gcc-help@gcc.gnu.org \
--cc=xorbe@yahoo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).