Bounds checks. (was variable-length struct hack)

Richard H. Gumpertz rhg at cpsolv.UUCP
Thu Dec 14 02:28:22 AEST 1989


In article <1989Dec12.190347.13521 at twwells.com> bill at twwells.com (T. William Wells) writes:
>The two are exactly the same:
>
>	&A[N] = &(*(A + N)) = A + N

No, the two are not exactly alike.  According to 3.3.6, *(A+N) is
undefined ("...the behavior is undefined if the result is used as an
operand of a unary * operator") and so &(*(A+N)) is undefined.  A+N, on
the other hand, is well defined.  I really believe that the wording in
3.3.6 is wrong; I cannot believe that the committee intended for A+N to
be legal but not &A[N].

Anyone on the committee care to respond?
-- 
===============================================================================
| Richard H. Gumpertz rhg%cpsolv at uunet.uu.NET -or- ...uunet!amgraf!cpsolv!rhg |
| Computer Problem Solving, 8905 Mohawk Lane, Leawood, Kansas 66206-1749      |
===============================================================================



More information about the Comp.std.c mailing list