Path: utzoo!attcan!uunet!wuarchive!udel!new From: new@udel.EDU (Darren New) Newsgroups: comp.lang.misc Subject: Re: Pointers as 3-tuples Message-ID: <16777@snow-white.udel.EDU> Date: 13 Apr 90 14:43:28 GMT References: <20197@megaron.cs.arizona.edu> Reply-To: new@ee.udel.edu (Darren New) Organization: University of Delaware Lines: 21 In article <20197@megaron.cs.arizona.edu> gudeman@cs.arizona.edu (David Gudeman) writes: >The problem has not changed at all. I wouldn't know how to write >those functions portably with "normal" pointers either unless (1) >there is a system function of some sort to tell me where to allocate >from (usually brk() or sbrk()) or (2) I declare my own array to >allocate from. Either way, the code is identical for "normal" >pointers as for bounds-checked pointers. Except that you lose the bounds checking in the array case. I.e., if you malloc(50) and then access element 52, as long as it is within your static array you won't get any violation. Also the case with sbrk() uless you can somehow set the bounds. >> for (i = 1; i < N-1; i++ ) >> for (j = 1; j < M-1; j++ ) >> A[i][j] = 0; > for (p = (t *)A; p < A + M * N; p++) *p = 0; These two are not identical. Note that the array-case does not clear the "outside edge" (0 or N) of the array (assuming that is what was meant). -- Darren