Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site ukma.UUCP Path: utzoo!watmath!clyde!cbosgd!hasmed!qusavx!ukma!david From: david@ukma.UUCP (David Herron, NPR Lover) Newsgroups: net.lang.c,net.lang.f77 Subject: Re: Converting FORTRAN to C Message-ID: <461@ukma.UUCP> Date: Sat, 5-Jan-85 17:53:42 EST Article-I.D.: ukma.461 Posted: Sat Jan 5 17:53:42 1985 Date-Received: Mon, 7-Jan-85 03:35:29 EST Organization: Univ. of KY Mathematical Sciences Lines: 29 Xref: watmath net.lang.c:3734 net.lang.f77:207 In article <103@physiol.OZ>, john@physiol.OZ (John Mackin) writes: >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). >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. :-) Aaaaahhhhhhh, but your code is not a *real* reference. It is simply a calculation of an address, and knowledge that for this array, a certain address is a good trailer value. I of course meant in my posting that any program that WRITES outside an array is already broken. (I know, I know, there are times when even that can be useful, such as the following #define's I wrote for someone with C on an apple. And ya know how them Apple programmers just can't program without putting in poke statements :-) .) #define poke(adr,val) (*((char *)adr)) = ((char)val) #define peek(adr) (*((char *)adr)) And Whitesmith's should be shot for being such a terminally *almost good* compiler.