Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!hplabs!hpda!hpcupt1!hpisod2!decot From: decot@hpisod2.HP.COM (Dave Decot) Newsgroups: comp.lang.c Subject: Re: how about sizeof(((type *)1)->member) ? Message-ID: <2550111@hpisod2.HP.COM> Date: 28 Oct 89 18:54:05 GMT References: <1989Oct27.141015.20578@talos.uucp> Organization: Hewlett Packard, Cupertino Lines: 16 > In article <1989Oct27.141015.20578@talos.uucp> kjones@talos.uu.net writes: > >If sizeof(((type *)0)->member) is forbidden, then is > >sizeof(((type *)1)->member) forbidden as well, in pANS > >conforming programs? > > The latter is not guaranteed to work in all implementations, > due to variation in addressing architectures (and memory "models"). > For example, "type" objects may require quadword alignment, > and the compiler can easily tell that the address constant value 1 > does not satisfy that constraint. OK, fine. My what a tiresome language. Here: sizeof(((struct foo *)(sizeof(struct foo)))->member) Dave