structure element offsets

rbutterworth at watmath.UUCP rbutterworth at watmath.UUCP
Wed Dec 10 04:30:05 AEST 1986


In article <509 at brl-sem.ARPA>, ron at brl-sem.ARPA (Ron Natalie <ron>) writes:
> What malloc provides is a (char *) that can be cast into other pointer
> types.  There is no guarantee that all legitimate pointer values can
> be represented by a (char *) cast of them.  Malloc is one of those very
> machine dependant magic routines that is careful to return very "special"
> character pointers that can be used as other data types, but to imply that
> the compiler always allows character pointers to be used for this mode
> is naive.

K&R must be naive then.  In 14.4 of the appendix:
"It is guaranteed that a pointer to an object of a given size may be
converted to a pointer to an object of a smaller size and back again
without change."



More information about the Comp.lang.c mailing list