Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!cmcl2!brl-adm!brl-smoke!gwyn From: gwyn@brl-smoke.ARPA (Doug Gwyn ) Newsgroups: comp.lang.c Subject: Re: char (*a)[] (was: Style [++i vs i++ - (nf) Message-ID: <6443@brl-smoke.ARPA> Date: Sun, 20-Sep-87 21:08:25 EDT Article-I.D.: brl-smok.6443 Posted: Sun Sep 20 21:08:25 1987 Date-Received: Mon, 21-Sep-87 03:40:54 EDT References: <1459@cullvax.UUCP> <48400001@tub.UUCP> Reply-To: gwyn@brl.arpa (Doug Gwyn (VLD/VMB) ) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 11 In article <48400001@tub.UUCP> cabo@tub.UUCP writes: > (char *)&((struct foo *)0)->bar - (char *)&((struct foo *)0)->baz >for computing the relative offset of two structure members in character >sized units. I'm not saying that the above is a constant expression >according to the wording of the draft (I don't have it, unfortunately), >but I would like it to be one. Unfortunately, X3J11 cannot guarantee that such use of null pointers would be portable. However, they have specified an offsetof() macro to accomplish what you're trying to do; it's still being debated and may change or (unlikely) vanish before the second public review.