🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #886

Re: bug in gcc-1.36 structure initialization .

#886
From: Geoffrey D. Alexander
Date: Wed, 17 Jan 1990 20:10
17 lines
1294 bytes
K&R, 2nd edition states the following in section A8.7 (bottom of page 219):

   The initializer for a union is either a single expression of the same
   type, or a brace-enclosed initializer for the first member of the union.

Note that MyStruct has one member of type MyUnion.  Since type MyUnion is a
union, it must either be initialize by an expression of type MyUnion or an
brace_enclosed initializer for the first member of the union which has type
char*.  I assume you wish to initialize abc.name to 0.  To do this, you must
have two set of braces:

  MyStruct abc = { {0} }

This compiles without error under gcc 1.36 on a Sun-3M60 running SunOS 4.0.3.
I don't believe the problem you reported is a bug.

Geoff Alexander
Technical Details
Message-ID: <11506@thorin.cs.unc.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!rutgers!mcnc!thorin!unc!alexande
References: <9001170733.AA09095@life.ai.mit.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!rutgers!mcnc!thorin!unc!alexande
From: alexande@unc.cs.unc.edu (Geoffrey D. Alexander)
Newsgroups: gnu.gcc.bug
Subject: Re: bug in gcc-1.36 structure initialization .
Message-ID: <11506@thorin.cs.unc.edu>
Date: 17 Jan 90 20:10:10 GMT
References: <9001170733.AA09095@life.ai.mit.edu>
Sender: news@thorin.cs.unc.edu
Reply-To: alexande@unc.cs.unc.edu (Geoffrey D. Alexander)
Distribution: gnu
Organization: University Of North Carolina, Chapel Hill
Lines: 17