bytes don't fill words

rbutterworth at watmath.UUCP rbutterworth at watmath.UUCP
Fri Jan 23 23:20:13 AEST 1987


If it doesn't do so already, the ANSI C standard should explicitly
state the following:

1) BITS_PER_WORD%BITS_PER_BYTE need not necessarily be 0.

2) Given TypeA and TypeB, such that sizeof(TypeA) > sizeof(TypeB)
and sizeof(TypeA) % sizeof(TypeB) is 0, then for
union {TypeA a; TypeB b[sizeof(TypeA)/sizeof(TypeB)];} u;
assigning values to all the individual members of array u.b will
in some well-defined implementation-defined manner assign values
to all the bits of u.a (but not necessarily of u itself).

3) The behaviour of functions memcmp(), memcpy(), etc. is
undefined if the two arguments are not pointing at similarly
aligned data.

I realize that the last two are obvious given the first, but it
took me a long time to realize that they were obvious and it would
be nice if the standard explictly pointed them out.



More information about the Comp.lang.c mailing list