alias accessing
Norman Diamond
diamond at csl.sony.co.jp
Fri Oct 20 18:03:08 AEST 1989
Consider the following program fragment:
int *a;
const int *b;
int z;
b = a = (int *) malloc (sizeof (int));
z = *b; /* legal access to *a (aliased) according to section 3.3 */
z = *a; /* illegal access to *b (aliased) according to section 3.3 */
Do I really understand section 3.3 correctly? If b is actually
declared in some other function which never wants to change the
value of *b, I still cannot put a "const" on it, unless I'm sure
that it will be aliased only to other consts.
[I have read the offending section three times slowly before posting
this foot.]
--
Norman Diamond, Sony Corp. (diamond%ws.sony.junet at uunet.uu.net seems to work)
Should the preceding opinions be caught or | James Bond asked his
killed, the sender will disavow all knowledge | ATT rep for a source
of their activities or whereabouts. | licence to "kill".
More information about the Comp.std.c
mailing list