is this array access portable?

Dale Worley worley at compass.com
Tue Jun 25 01:12:52 AEST 1991


In article <1991Jun23.185351.5695 at thunder.mcrcim.mcgill.edu> mouse at thunder.mcrcim.mcgill.edu (der Mouse) writes:
   The thing that makes me think it has to work is a
   sentence in the New Testament A7.4.8 (page 204): ``[...]: the size of
   an array of n elements is n times the size of one element.'', which,
   applied recursively, appears to imply that the elements of an
   N-dimensional array must be packed together as if in a one-dimensional
   array of the appropriate size.  (I'm also not *quite* certain that even
   if this is true, a pointer can sleaze past the boundary safely....)

I think the trouble you get into is that you can't guarantee to
increment the pointer from the last element of one row to the first
row of another, even if they are stored adjacently.  (See 3.3.6.)
However, I can't work out a practical example.

Dale Worley		Compass, Inc.			worley at compass.com
--
Taking a trip by air? Next time ask to be seated in the "Comedy" section.



More information about the Comp.lang.c mailing list