Is &a[NTHINGS] legal

Greg Limes limes at sun.uucp
Sat May 7 07:52:44 AEST 1988


In article <1086 at gazette.bcm.tmc.edu> biff at eyeball.ophth.bcm.tmc.edu.UUCP (Brad Daniels) writes:
>
>Whether or not the above is legal, I think it should probably be written as:
>
>	for (p = a; p < (a+NTHINGS); p++)
>
>Or am I missing something obvious?

What if (a+NTHINGS) wraps around the address space in such a way that
(a+NTHINGS) < a? Loop #1 would execute 0 times, loop #1 would execute
properly ... translating to your style (which looks better to these
eyes),
	for (p = a; p <= (a+NTHINGS-1); p++)
-- 
   Greg Limes [limes at sun.com]			Illigitimi Non Carborundum



More information about the Comp.lang.c mailing list