Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.2 9/18/84; site brl-tgr.ARPA
Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!genrad!panda!talcott!harvard!seismo!brl-tgr!gwyn
From: gwyn@brl-tgr.ARPA (Doug Gwyn )
Newsgroups: net.lang.c
Subject: Re:  Portability question
Message-ID: <2836@brl-tgr.ARPA>
Date: Mon, 4-Nov-85 23:59:43 EST
Article-I.D.: brl-tgr.2836
Posted: Mon Nov  4 23:59:43 1985
Date-Received: Thu, 7-Nov-85 04:33:05 EST
References: <2834@brl-tgr.ARPA>
Organization: Ballistic Research Lab
Lines: 40

>     struct x {something};
>     struct x *ip;
> 
>     struct
>       {
>           struct x a;
>           struct x b;
>           struct x c;
>           struct x d;
>           struct x e;
>       }
>           index;
> 
>     y = index.a.whatever;
>     z = index.c.whatever;
> 
>     ip = (struct x *)&index;
>     ...
>     w = ip[i].whatever;

That is not guaranteed to work, primarily because there
may be padding between the members of `index'.  However,
it is unlikely that there would be padding since it
would normally be contained within a `struct x'.

Consider the following less elaborate code:

	struct x {something};

	struct x array[5];
	#define	a array[1]
	#define	b array[2]
	#define	c array[3]
	#define	d array[4]
	#define	e array[5]

	y = a.whatever;
	z = c.whatever;
	...
	w = array[i].whatever;