Path: utzoo!mnetor!uunet!seismo!sundc!pitstop!sun!limes
From: limes@sun.uucp (Greg Limes)
Newsgroups: comp.lang.c
Subject: Re: Is &a[NTHINGS] legal
Message-ID: <52339@sun.uucp>
Date: 6 May 88 21:52:44 GMT
References: <12074@tut.cis.ohio-state.edu> <1086@gazette.bcm.tmc.edu>
Reply-To: limes@sun.UUCP (Greg Limes)
Organization: Sun Microsystems, Mountain View
Lines: 15

In article <1086@gazette.bcm.tmc.edu> biff@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@sun.com]			Illigitimi Non Carborundum