Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!seismo!lll-crg!ames!ucbcad!ucbvax!decvax!mcnc!rti-sel!dg_rtp!meissner
From: meissner@dg_rtp.UUCP (Michael Meissner)
Newsgroups: comp.lang.c
Subject: Re: structure element offsets
Message-ID: <754@dg_rtp.UUCP>
Date: Sat, 13-Dec-86 13:22:09 EST
Article-I.D.: dg_rtp.754
Posted: Sat Dec 13 13:22:09 1986
Date-Received: Tue, 16-Dec-86 01:04:46 EST
References: <1096@spice.cs.cmu.edu> <768@nike.UUCP> <3622@watmath.UUCP> <386@viper.UUCP> <3695@watmath.UUCP> <419@viper.UUCP>
Reply-To: meissner@dg_rtp.UUCP (Michael Meissner)
Distribution: world
Organization: Data General (Languages @ Research Triangle Park, NC.)
Lines: 21

In article <419@viper.UUCP> dave@viper.UUCP (David Messer) writes:
>
> Because your solution doesn't work all the time either.  There are
> some machines in which pointers to different types are unrelated
> in format.  In other words a cast such as (type1 *)(type2 *)x
> will not always give a meaningful answer.  According to K&R all
> that is required is that (type *)(long *)x == x.

I hate to be picky, but what K&R requires is that:

	(type *)(char *)x == x

work (ie, it will only work if the pointer type you are converting to is
of less strict alignment (or the same) and back again.  ANSI X3J11 goes
further, and mandates that function pointers are not allowed to be converted
to object pointers.  For word based machines (like the Data General MV-series
computers), this conversion may cause conversion, to/from the pointer type.

	Michael Meissner
	Data General
	...!mcnc!rti-sel!dg_rtp!meissner