Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!rbutterworth From: rbutterworth@watmath.UUCP Newsgroups: comp.lang.c Subject: Re: structure element offsets Message-ID: <3863@watmath.UUCP> Date: Tue, 9-Dec-86 13:30:05 EST Article-I.D.: watmath.3863 Posted: Tue Dec 9 13:30:05 1986 Date-Received: Wed, 10-Dec-86 09:10:51 EST References: <1096@spice.cs.cmu.edu> <768@nike.UUCP> <3622@watmath.UUCP> <509@brl-sem.ARPA> Organization: U of Waterloo, Ontario Lines: 13 Keywords: structure, offset In article <509@brl-sem.ARPA>, ron@brl-sem.ARPA (Ron Natalie ) 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."