delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/12/23/10:24:41

Date: Tue, 23 Dec 1997 10:23:39 -0500 (EST)
Message-Id: <199712231523.KAA02006@delorie.com>
To: DJGPP mailing list <djgpp AT delorie DOT com>
From: Alexander Bokovoy <bokovoy AT bspu DOT ac DOT by>
Subject: Re: The warning 'missing braces' is driving me crazy...
In-Reply-To: <349ede8a.25515152@news.jet.es>
References: <349ede8a DOT 25515152 AT news DOT jet DOT es>
MIME-Version: 1.0

On Tue, 23 Dec 1997 13:52:44 GMT gregorio AT jet DOT es (Grzegorz Adam Hankiewicz)
wrote:

> Hello.
> 
> For some time i've compiled my programs without warning flags.
> Now I compile with -Werror -Wall -W.
> 
> The point is that I can't recompile some old source. There, I make the
> following definition/declaration/whateverisitsname :
> 
> char line[4][2] = {2,1,2,1,
> 		3,4,2,1};
> 
> The compiler points me to that line and says:
> 
> l.c(5) Warning:  missing braces around initializer for `line[0]'
> 
> I guess you can figure out my question. How do I avoid these 'missing
> braces' warnings?
You declared 2D array and compiler waits to appropriate form of data but
gets data for linear array. Solution: use right form of data
char line[4][2] = {{2,1},{2,1},{3,4},{2,1}};
BTW, this question is not directly connected with DJGPP but with 
general C language programing. 

Alexander Bokovoy, <bokovoy AT bspu DOT ac DOT by>
---== The Soft Age coming soon ==---

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019