Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uunet!tut.cis.ohio-state.edu!husc6!redsox!campbell From: campbell@redsox.bsw.com (Larry Campbell) Newsgroups: comp.lang.c Subject: Re: Array bounds checking with C???? Message-ID: <1589@redsox.bsw.com> Date: 4 Sep 90 02:33:10 GMT References: <7611@ucdavis.ucdavis.edu> <26196@mimsy.umd.edu> <988@christopher-robin.cs.bham.ac.uk> Reply-To: campbell@redsox.bsw.com (Larry Campbell) Organization: The Boston Software Works, Inc. Lines: 24 Are there actually any current compilers out there that are so stupid that they generate substantially different code for the following two code fragments? /* Fragment 1 */ for (p = array; p < &array[ARRAY_SIZE]; p++) *p++ = '\0'; /* Fragment 2 */ for (i = 0; i < ARRAY_SIZE; i++) array[i] = '\0'; If the answer to my question is "no", then the only excuse for permitting array indices past the end of an array is for compiling old, crufty code from clay tablets. If the answer to my question is "yes", then I think we should flame the culpable compiler vendors to a crisp. (hmmm, just tried this on SysV/386, and I guess I have to send a flame to AT&T... sigh...) -- Larry Campbell The Boston Software Works, Inc. campbell@redsox.bsw.com 120 Fulton Street wjh12!redsox!campbell Boston, MA 02109