[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
C99 aliasing rules
From: |
Ludovic Courtès |
Subject: |
C99 aliasing rules |
Date: |
Mon, 10 Jan 2005 09:55:20 +0100 |
User-agent: |
Mutt/1.5.3i |
Hi,
On Fri, Jan 07, 2005 at 08:34:04PM +0100, Marcus Brinkmann wrote:
> Restrict means something completely different: Restrict says that
> pointers to the _same_ type point to non-overlapping storage. It is
> in this sense stricter than the normal aliasing rule.
Ok, I see.
> Aliasing is defined in the C standard in section 6.5 (#7). Good luck
> in wrapping your head around the wording of the standard. It took me
> a couple of days and some research into various usenet discussions,
> and a perusal of the pending defect reports about this issue to
> understand the issues involved and to accept the brutality of the
> aliasing rules.
However, the example you gave:
typedef union
{
_L4_msg_t _msg;
__L4_msg_tag_t tag;
} __L4_msg_t;
void
_L4_msg_get (_L4_msg_t msg, _L4_word_t *untyped, void *any_typed)
{
__L4_msg_t *_msg = (__L4_msg_t *) msg;
...
}
should work because _msg's type is an aggregate that includes msg's type
among its members. Am I missing something?
If this didn't work, this would prevent any similar use of "structure
inheritance", which would be quite unfortunate given that it's widely
used (as in Glib, GTK+, etc.). If I'm right, it's not _that_ brutal.
;-)
> I doubt it's legal - to my knowledge there is no legal downloadable
> copy of ISO C99 on the net.
Right, and that's a pity.
Thanks,
Ludovic.
- Re: Contribution to the Hurd on L4, Marcus Brinkmann, 2005/01/06
- Re: Contribution to the Hurd on L4, Matthieu Lemerre, 2005/01/06
- Re: Contribution to the Hurd on L4, Ludovic Courtès, 2005/01/07
- Re: Contribution to the Hurd on L4, Marcus Brinkmann, 2005/01/07
- Re: Contribution to the Hurd on L4, David Leimbach, 2005/01/08
- C99 aliasing rules,
Ludovic Courtès <=
- Re: C99 aliasing rules, Marcus Brinkmann, 2005/01/10
- Re: C99 aliasing rules, Philip Nilsson, 2005/01/14