Do all arrays have to have a pad byte after them?

Mike Stump mrs@wrs.com
Fri Nov 13 12:50:00 GMT 1998


> Date: Thu, 12 Nov 1998 14:45:18 -0500
> From: Hyman Rosen <hymie@prolifics.com>
> To: egcs-bugs@cygnus.com

> Section 5.10 of the standard says
> "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."

> This seems to imply that all arrays, even those in structures, require
> at least one byte of padding to separate the past-the-end pointer of
> one from the beginning of the next.

> So the following code should print "succeeded", but it prints "failed"
> with the latest egcs (on Linux).

I disagree.  I said:

  Otherwise if either is a pointer to a virtual member function, the
  result is unspecified.  Otherwise they compare equal if and only if
  they would refer to the same member of the same most derived object
  (1.7) or the same subobject if they were dereferenced with a
  hypothetical object of the associated class type.

The one that kicks is if they were dereferenced, but we can't do that
so this doesn't apply.  I think the wording has a bug in it, if it
doesn't support my position.



More information about the Gcc-bugs mailing list