From: SourceForge.net <no...@so...> - 2005-10-22 23:29:11
|
Bugs item #1335154, was opened at 2005-10-22 23:14 Message generated for change (Comment added) made by tecodev You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=100599&aid=1335154&group_id=599 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. >Category: C-Front End >Group: non bugs >Status: Pending >Resolution: Invalid Priority: 5 Submitted By: Nobody/Anonymous (nobody) Assigned to: Nobody/Anonymous (nobody) Summary: Initialization of structure array Initial Comment: email: ji...@ji... Example below similar to Kernihan & Ritchie [1978], p 124. Gives error 69 using SDCC. struct { int a; int b; } astruc[] = { 1, 1, 2, 2 }; void main(void) { } ---------------------------------------------------------------------- >Comment By: Raphael Neider (tecodev) Date: 2005-10-22 23:29 Message: Logged In: YES user_id=1115835 SDCC output: init.c:4: error 69: struct/union/array 'astruc' :initialization needs curly braces This is perfectly fine for me -- add curly braces around each struct initializer and you are done. I guess your code is non-valid ANSI C code (according do a draft of the standard, struct and union initializers must be brace-enclosed (6.7.8:16)). Can anyone confirm this? Fixed code: struct { int a; int b; } astruc[] = { {1, 1}, {2, 2} }; void main(void) { } ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=100599&aid=1335154&group_id=599 |