Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/17/84; site plus5.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxj!ihnp4!plus5!hokey From: hokey@plus5.UUCP (Hokey) Newsgroups: net.lang.c Subject: Re: Must a NULL pointer be a 0 bit pattern? Message-ID: <504@plus5.UUCP> Date: Fri, 19-Oct-84 02:29:55 EDT Article-I.D.: plus5.504 Posted: Fri Oct 19 02:29:55 1984 Date-Received: Sun, 21-Oct-84 12:36:34 EDT References: <6542@mordor.UUCP> <5272@brl-tgr.ARPA> <196@rlgvax.UUCP> <529@wjh12.UUCP> Organization: Plus Five Computer Services, St. Louis Lines: 24 Keywords: union initialization > ANSI C deals with this by giving a rule for explicit initialization > of unions: the first member is the one that is initialized. Implicit > initialization can use the same rule, meaning that in the above example, > only p_member would be guaranteed to start out as a zero (null) value. I'm not up on the reasons for using the first member of the union being the one which is initialized. I can see how initialization of unions can be very useful (I need it in several places), but why the constraint on the type? If I have an external structure in which a member is a union which I want to initialize, I gather I am out of luck unless the elements of the union which I am initializing are of the same type. It would be much more useful to be able to (explicitly) initialize a union to *any* legal value. I don't see why this is either bad or hard. K&R states in 6.8 (page 139) that "It is the responsibility of the programmer to keep track of what type is currently stored in a union;...". Can somebody tell me either why the ANSI C restriction is there, or where I am missing the point? -- Hokey ..ihnp4!plus5!hokey 314-725-9492