Do all arrays have to have a pad byte after them?
Nathan Sidwell
nathan@acm.org
Sat Nov 14 05:55:00 GMT 1998
Hyman Rosen wrote:
>
> Dave Brolley writes:
> > While comparing the pointers one past the end is defined, dereferencing
> > them is not. There is no need for a padding byte to actually be allocated
> > in memory. Even so, I would expect the test to print "failed" when
> > compiled with most compilers.
>
> I repeat the quote from the standard, section 5.10 -
>
> Two pointers of the same type compare equal if and only if they are
> both null, both point to the same object or function, or both point
> one past the end of the same array.
Your analysis assumes that a pointer cannot simultaneously point to one
past the end of one array and the beginning of another array. I don't
believe the standard prohibits that.
nathan
--
Dr Nathan Sidwell :: Computer Science Department :: Bristol University
You can up the bandwidth, but you can't up the speed of light
nathan@acm.org http://www.cs.bris.ac.uk/~nathan/ nathan@cs.bris.ac.uk
More information about the Gcc-bugs
mailing list