Is &a[NTHINGS] legal

Doug Gwyn gwyn at brl-smoke.ARPA
Sun May 8 08:22:46 AEST 1988


In article <52339 at sun.uucp> limes at sun.UUCP (Greg Limes) writes:
>In article <1086 at gazette.bcm.tmc.edu> biff at eyeball.ophth.bcm.tmc.edu.UUCP (Brad Daniels) writes:
>>	for (p = a; p < (a+NTHINGS); p++)
>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++)

That wasn't the fellow's question.

In any case, your suggestion fails for NTHINGS==0, since a-1 CAN wrap
around the address space; the original CANNOT wrap around (it is
forbidden by the language rules).  You got this exactly backwards.



More information about the Comp.lang.c mailing list