🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #51720

Re: Problem initializing a structure array

#51720
From: Michael T.Y. McNamara
Date: Fri, 16 Apr 1993 23:01
54 lines
2303 bytes
In article <bignum@iiasa.ac.at> marek@iiasa.ac.at (Marek  MAKOWSKI) writes:
|Keith Mason (keith@netcom.com) wrote:
|: I have a piece of code that looks like this:
|: 
|:   typedef struct _item {
|:     char *a;
|:     char *b;
|:   } item;
|: 
|:   item x[2] = {
|:     "One",  "Two",
|:     "Three, "Four"
|:   };
|: 
|: And I get back 
|: 
|:    file.c:9: warning: aggregate has a partly bracketed initializer
|:    file.c:9: warning: aggregate has a partly bracketed initializer
|:    file.c:9: warning: aggregate has a partly bracketed initializer
|:    file.c:9: warning: aggregate has a partly bracketed initializer
|: 
|: What am I doing wrong here?  And why isn't is correct?
|: 
|Initialization should read:
|  item x[] = {		
|     {"One",  "Two"},
|     {"Three, "Four"}
|  };
|
|Marek Makowski
|-- 
|                  Marek Makowski  | Email: marek@iiasa.ac.at
|         International Institute  | Phone: +43 02236 71.5210
|     for Applied System Analysis  | Fax:   +43 02236 71.313
|       A-2361 Laxenburg, Austria  | Telex: 079137 iiasa a

	Yes, that does shut gcc up, but why is this now deemed
a warn-able offense?

	I realize fully bracketing is useful so you can do:
  item x[] = {		
     {"One",  "Two"},
     {"Three, },      /* Employee "Four" quit :-( */
     {"Five", "Six"},
  };
	and have it zero fill, but the question remains: 
"Why did you pull me over, officer?"


-- 
			  __	  ______
Michael T.Y. McNamara  -o|  \_____|    |------ 1+(415) 965-3312     
C H R O N O L O G I C  --|__/     |    |       1+(415) 965-2705 FAX 
 --------. Simulation  -----------|>   |------ mac@chronologic.com  
Technical Details
Message-ID: <1993Apr16.230126.27614@chronologic.com>
Path: arc1-ca.pugleaf.net!gmd.de!Germany.EU.net!mcsun!uunet!haven.umd.edu!darwin.sura.net!sgiblab!news.kpc.com!kpc!chrnlgc!mac
References: <keithC5K3A3.Eq9@netcom.com> <1993Apr16.114433.4042@iiasa.ac.at>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,ffcc861fa54e6e8a
X-Google-Attributes: gid11318c,public
X-Google-ArrivalTime: 1993-04-16 17:39:31 PST
Newsgroups: gnu.gcc.help
Path: arc1-ca.pugleaf.net!gmd.de!Germany.EU.net!mcsun!uunet!haven.umd.edu!darwin.sura.net!sgiblab!news.kpc.com!kpc!chrnlgc!mac
From: mac@chronologic.com (Michael T.Y. McNamara)
Subject: Re: Problem initializing a structure array
Message-ID: <1993Apr16.230126.27614@chronologic.com>
Organization: Chronologic Simulation
References: <keithC5K3A3.Eq9@netcom.com> <1993Apr16.114433.4042@iiasa.ac.at>
Date: Fri, 16 Apr 1993 23:01:26 GMT
Lines: 54