Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > strict aliasing rules in ISO C, someone understands them ?

Thread Tools

strict aliasing rules in ISO C, someone understands them ?

Posts: n/a
On Mon, 24 Oct 2005 13:40:55 +0000, S.Tobias wrote:
> Netocrat <(E-Mail Removed)> wrote:
>> On Wed, 19 Oct 2005 13:24:27 +0000, S.Tobias wrote:
>>> Removed) wrote:

>> [...]
>>>> It is not explicitly mentioned in the standard, but if access is
>>>> done through a struct, its type must match the type of the container of
>>>> the object we want to access.
>>> It is mentioned at the member access operators. If it weren't, nobody
>>> whould argure this.

>>I see no
>> mention of it in N869's " Structure and union members" which is the
>> section to which I presume you're referring.

> My bad, sorry. It's not explicitly mentioned, but can be derived.
> Pp. 3 and 4 refer to a "member of a structure or union object"; it means
> the operator (and behaviour) is defined iff the _object_ has the specified
> member.

OK - I was expecting something more explicit - the "iff" is implied - but
this seems to be a correct interpretation of the document's intent.

> (However, I decline to explain what exactly it should be; I
> think the Std means the effective type of the object; it's one of the
> questions on my list to c.s.c.)

What else would it be?[*]

> Anyway, if the Std text is not enough, then at least Example 3 shows the
> intention; if it were allowed (in the example) to access `t1::m' with
> `p2->m' (or vv.), then the second part of the example would be moot, as
> well as the "special guarantee" of p. 5 would.

Sure - that makes the intent plain, even if the prior wording is not.
[*] My reaction to your comment in another thread - that you have your own
idea of what it means to "complete a type" - was similar: how many
alternative interpretations could there be?

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
warning of breaking strict-aliasing rules Noob C Programming 9 05-07-2012 10:48 PM
char and strict aliasing Paul Brettschneider C++ 4 07-18-2008 12:22 PM
-fno-strict-aliasing turned off when cross compiling Squat'n Dive Python 3 01-17-2008 08:26 PM
dereferencing type-punned pointer will break strict-aliasing rules David Mathog C Programming 3 07-05-2007 12:04 AM
Strict Pointer Aliasing Question Bryan Parkoff C++ 2 01-15-2004 06:43 PM