Newsgroups: comp.lang.c
Path: utzoo!henry
From: henry@zoo.toronto.edu (Henry Spencer)
Subject: Re: accessing initial common structure members
Message-ID: <1990Oct21.051028.11018@zoo.toronto.edu>
Organization: U of Toronto Zoology
References: <31468@netnews.upenn.edu>
Date: Sun, 21 Oct 90 05:10:28 GMT

In article <31468@netnews.upenn.edu> kozak@grad1.cis.upenn.edu (Chuck Kozak) writes:
>I have seen code where the first N members of different structures
>are accessed by code that treats the structures as identical.  I
>looked through K&R II to check whether this practice is legal and
>cannot find any mention of it...

ANSI C promises that this will work only when all the structures in
question are within a union.  (Sufficiently determined theological
reasoning might possibly demonstrate that this suffices to guarantee
it everywhere.)  It is dubious practice at best.
-- 
The type syntax for C is essentially   | Henry Spencer at U of Toronto Zoology
unparsable.             --Rob Pike     |  henry@zoo.toronto.edu   utzoo!henry
