Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!ontek!mikey From: mikey@ontek.com (Interplanetary Krill) Newsgroups: comp.lang.c Subject: Re: Array bounds checking with C???? Message-ID: <1340@ontek.com> Date: 5 Sep 90 23:12:03 GMT References: <1589@redsox.bsw.com> Organization: Ontek Corporation -- Laguna Hills, California Lines: 18 In comp.lang.c, campbell@redsox.bsw.com (Larry Campbell) writes: | 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'; Fragment 2 is superior in that it initializes the entire array rather than just elements with even numbered indexes. __ /x \/| \__/\|