V
viza
Hi all,
if I have:
void *vptr= malloc( ENOUGH );
is this guaranteed to always be true:
( (sometype*)vptr ) + 1 == vptr + sizeof(sometype)
it fails of course if sometype is void, and gcc sometimes screams
about void pointer arithmetic.
Also, is sizeof(char) guaranteed to always be 1? How does this
interact with CHAR_BIT?
Also, are
sizeof(unsigned sometype) == sizeof(sometype)
sizeof(unsigned sometype) == sizeof(signed sometype)
always guaranteed to be true for types which can be modified by signed
and unsigned?
On a similar track, what about:
( (unsigned sometype*)vptr ) + 1 == ( (sometype*)vptr ) + 1
( (unsigned sometype*)vptr ) + 1 == ( (signed sometype*)vptr ) + 1
Thanks,
viza
if I have:
void *vptr= malloc( ENOUGH );
is this guaranteed to always be true:
( (sometype*)vptr ) + 1 == vptr + sizeof(sometype)
it fails of course if sometype is void, and gcc sometimes screams
about void pointer arithmetic.
Also, is sizeof(char) guaranteed to always be 1? How does this
interact with CHAR_BIT?
Also, are
sizeof(unsigned sometype) == sizeof(sometype)
sizeof(unsigned sometype) == sizeof(signed sometype)
always guaranteed to be true for types which can be modified by signed
and unsigned?
On a similar track, what about:
( (unsigned sometype*)vptr ) + 1 == ( (sometype*)vptr ) + 1
( (unsigned sometype*)vptr ) + 1 == ( (signed sometype*)vptr ) + 1
Thanks,
viza