Newsgroups: comp.lang.c Path: utzoo!henry From: henry@zoo.toronto.edu (Henry Spencer) Subject: Re: Union element alignment query Message-ID: <1990Nov17.221217.25081@zoo.toronto.edu> Organization: U of Toronto Zoology References: <810001@hplred.HP.COM> Date: Sat, 17 Nov 90 22:12:17 GMT In article <810001@hplred.HP.COM> curry@hplred.HP.COM (Bo Curry) writes: >union { > FOOTYPE a[4]; > BARTYPE b; >} combo; > >Does the standard guarantee that (void *)(&combo.a[0]) == (void *)(&combo.b) ? It guarantees (3.5.2.1) that a pointer to the union points to each of its members, after suitable conversion. That is not *quite* what you are asking, but I think it would take a seriously bizarre implementation to do otherwise. It may be possible to prove your equality, although it would take non-trivial reasoning. -- "I don't *want* to be normal!" | Henry Spencer at U of Toronto Zoology "Not to worry." | henry@zoo.toronto.edu utzoo!henry