Converting FORTRAN to C

David Sherman dave at lsuc.UUCP
Thu Jan 3 06:59:12 AEST 1985


In article <103 at physiol.OZ> john at physiol.OZ (John Mackin) writes:
|| There is at least one excellent reason, commonly used in C, for referencing
|| beyond the bounds of an array.  It is this:
|| 
||     for (p = array; p < &array[ARRAYSIZE]; p++)

Hmm. I'd MUCH rather say
	for(p = array; p - array < ARRAYSIZE; p++)

which doesn't break any compiler. But your point is well taken;
your example shouldn't be grounds for compiler indigestion.

Dave Sherman
-- 
{utzoo pesnta nrcaero utcs}!lsuc!dave
{allegra decvax ihnp4 linus}!utcsrgv!lsuc!dave



More information about the Comp.lang.c mailing list