From: Tom Seddon Newsgroups: comp.os.msdos.djgpp Subject: Re: The warning <-- Solved. Thank you Date: Tue, 30 Dec 1997 16:13:22 +0000 Distribution: world Message-ID: <$mzeZTAi2Rq0Iw0$@sunholme.demon.co.uk> References: NNTP-Posting-Host: sunholme.demon.co.uk MIME-Version: 1.0 Lines: 27 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk In article , Noam Rotem writes >I agree with you completely (and apologize for this long long >responsa, but I might be missing something in this whole >topic), but is there ANY possibility that someone will write >this wrong code deliberately? If so, it should be a legal >syntax, accompanied with a general warning for those who >wrote it by mistake. But, if it is NEVER a correct syntax, >and in no case it should be written, then let it be an error. >Am I missing something? > >I'm referring, by the way, to the following code: > >int A[4][2]={{1,2,3,4},{5,6,7,8}}; Presumably, an error occurs when what has been input is definitely wrong, or incomprehensible to the C compiler, in such a way that compilation has to stop as there is no alternative. The example above, although obviously wrong, is not really syntactically incorrect, is meaningful C, and does not mean that compilation has to stop but just that some of the array initializers will be discarded. gcc continues to compile but lets you know anyway. Perhaps the main difference is how the authors of the respective compilers think errors such as this should be treated -- or maybe there is something in the ANSI standard about this sort of thing. --Tom