Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!compass!worley From: worley@compass.com (Dale Worley) Newsgroups: comp.lang.c Subject: Re: is this array access portable? Message-ID: Date: 24 Jun 91 15:12:52 GMT References: <1991Jun23.185351.5695@thunder.mcrcim.mcgill.edu> Sender: root@compass.com Distribution: world Organization: Compass, Inc., Wakefield, MA, U.S.A. Lines: 17 In-reply-to: mouse@thunder.mcrcim.mcgill.edu's message of 23 Jun 91 18:53:51 GMT In article <1991Jun23.185351.5695@thunder.mcrcim.mcgill.edu> mouse@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@compass.com -- Taking a trip by air? Next time ask to be seated in the "Comedy" section.