[comp.std.c] alias accessing

diamond@csl.sony.co.jp (Norman Diamond) (10/20/89)

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@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".