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

Date: Tue, 23 Dec 1997 17:02:00 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Grzegorz Adam Hankiewicz <gregorio AT jet DOT es>
cc: djgpp AT delorie DOT com
Subject: Re: The warning 'missing braces' is driving me crazy...
In-Reply-To: <349ede8a.25515152@news.jet.es>
Message-ID: <Pine.SUN.3.91.971223165857.14788E-100000@is>
MIME-Version: 1.0

On Tue, 23 Dec 1997, Grzegorz Adam Hankiewicz wrote:

> 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 say this instead (untested!):

	char line[4][2] = { {2,1}, {2,1}, {3,4}, {2,1} };

You also yell at the lazy author of the original code who wanted to
exploit the fact that omitting the second level of braces only causes
a warning in C. 

- Raw text -


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