Another silly question

Rob Carriere rob at kaa.eng.ohio-state.edu
Thu May 18 11:02:16 AEST 1989


In article <2336 at Portia.Stanford.EDU> mesmo at Portia.Stanford.EDU (Chris Johnson)
writes:
>	The supposed proof of a[i] == i[a] rests on the faulty
>	assumption that (x+y) == (y+x) in all contexts; this is
>	not correct.

No it doesn't.  It relies on a direct statement in K&R I (pg 210, 1st par)

"Therefore, despite its asymmetric appearance, subscripting is a
commutative operation."

>	When "+" denotes simple (ie int/float/etc) arithmetic, the
>	operation commutes; when it denotes pointer arithmetic,
>	commutation is not legal/meaningful.

There is no such statement in K&R; in fact, the paragraph from the
above quote came implies the oppposite and so does the section on the
"+" operator (A7.4, pg188--189)

SR



More information about the Comp.lang.c mailing list