[MPlayer-dev-eng] [PATCH] Drop support for gcc-2.95
Uoti Urpala
uoti.urpala at pp1.inet.fi
Thu Jul 13 00:32:44 CEST 2006
On Wed, 2006-07-12 at 17:36 -0400, Rich Felker wrote:
> The standard guarantees that foo.a evaluates to a pointer to character
> pointing to a location offsetof(struct whatever, a) bytes from the
> beginning of the malloc'd block. It is semantically equivalent to any
> other pointer to this byte, which means that foo.a[1] is an lvalue
> referring to the next byte in the malloc'd block after the byte
> overlapping foo.a.
But this is specific to char pointers only, based on the special case I
mentioned.
> If you look at the semantics for malloc and the definition of
> "object", I think you'll find that the same is true for types other
> than character.
I see no reason why this would be guaranteed for any type other than
char. If the current array explicitly has size 1 I see nothing which
would force the implementation to have defined behavior for pointer
additions which go outside the array. Only char pointers are guaranteed
to continue iterating over a larger object.
More information about the MPlayer-dev-eng
mailing list