Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.2 9/18/84; site watdaisy.UUCP
Path: utzoo!watmath!watdaisy!ndiamond
From: ndiamond@watdaisy.UUCP (Norman Diamond)
Newsgroups: net.lang.c,net.lang.f77
Subject: Re: Converting FORTRAN to C
Message-ID: <6840@watdaisy.UUCP>
Date: Wed, 2-Jan-85 13:26:22 EST
Article-I.D.: watdaisy.6840
Posted: Wed Jan  2 13:26:22 1985
Date-Received: Thu, 3-Jan-85 01:08:24 EST
References: <435@ukma.UUCP> <103@physiol.OZ>
Organization: U of Waterloo, Ontario
Lines: 26
Xref: watmath net.lang.c:3643 net.lang.f77:200

> There is at least one excellent reason, commonly used in C, for referencing
> beyond the bounds of an array.  It is this:
> 
> #define	ARRAYSIZE	200
> 
> type_t array[ARRAYSIZE];
> 
> ...
> 
>     type_t *p;
> 
>     for (p = array; p < &array[ARRAYSIZE]; p++)
> 	...

&array[ARRAYSIZE] does not reference any part of the array.  However, after
the loop is exited due to the stated condition, if code dereferences p (i.e.
uses *p), THEN the code is referencing beyond the array bounds and is broken
and should not be of concern to language translators.

-- Norman Diamond

UUCP:  {decvax|utzoo|ihnp4|allegra|clyde}!watmath!watdaisy!ndiamond
CSNET: ndiamond%watdaisy@waterloo.csnet
ARPA:  ndiamond%watdaisy%waterloo.csnet@csnet-relay.arpa

"Opinions are those of the keyboard, and do not reflect on me or higher-ups."