Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B UNSW 1.0 3/14/84; site physiol.OZ Path: utzoo!linus!decvax!mulga!munnari!basser!physiol!john From: john@physiol.OZ (John Mackin) Newsgroups: net.lang.c,net.lang.f77 Subject: Re: Converting FORTRAN to C Message-ID: <103@physiol.OZ> Date: Sun, 30-Dec-84 04:45:10 EST Article-I.D.: physiol.103 Posted: Sun Dec 30 04:45:10 1984 Date-Received: Tue, 1-Jan-85 05:56:07 EST References: <435@ukma.UUCP> Organization: Physiology, Uni of Sydney, Australia Lines: 30 In article <435@ukma.UUCP>, david@ukma.UUCP (David Herron, NPR Lover) writes: > Any program that is referencing outside > the bounds of an array is already broken, and should be shot on > sight. :-) (unless it can give good reason for behaving in such a manner). 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++) ... Now, sure you could say "p <= &array[ARRARYSIZE - 1]" instead. But which is clearer, and easier to read ... and, more importantly, used in many, many places in V7 UNIX as distributed by AT&T? I get VERY ANGRY at compilers like Whitesmiths' (for VAX/VMS, at least) that get upset about this construct. After all, this is C, not PASCAL or some other wimp's language that checks array bounds. :-) John Mackin, Physiology Department, University of Sydney, Sydney, Australia ...!decvax!mulga!physiol.su.oz!john