From: "Ya'qub" Newsgroups: comp.os.msdos.djgpp References: <37367f71 DOT 6271443 AT news DOT wanadoo DOT fr> <3736A098 DOT 55E268BE AT softhome DOT net> <373c0195 DOT 3902906 AT news DOT wanadoo DOT fr> Subject: Re: ? array[n] or array[n+1] ? Date: Tue, 11 May 1999 10:19:16 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2014.211 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2014.211 NNTP-Posting-Host: 193.123.236.199 Message-ID: <3737f542.0@nnrp1.news.uk.psi.net> X-Trace: 11 May 1999 10:15:46 GMT, 193.123.236.199 Lines: 32 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Greetings, With all due respect, this explanation does not seem very convincing. Surely, the compiler *should* complain when you do such a thing as overrunning an array. I hoped that the compiler would help such a poor programmer as myself in catching such bugs which I suppose could cause quite a lot of headache to locate. Can anybody else confirm that gcc makes such assumptions that we know what we are doing and let us carry on regardless. Also, out of curiosity, if you do overrun an array and the program has compiled without any warning or error, is there anything that can be said about its execution? i.e. do we know what is going to happen when the program tries to access an element from the array beyond its length. Thanks Regards, Ya'qub Gallicus wrote in message news:373c0195 DOT 3902906 AT news DOT wanadoo DOT fr... > On Mon, 10 May 1999 19:02:16 +1000, Chris Mears > wrote: > > >Because you're overrunning the array. "int bit[63][6]" means that the > >first index must be between 0 and 62 inclusive, and the second is > >between 0 and 5, inclusive. I don't know why Visual C complains, but > >the reason djgpp doesn't is because it trusts you. It assumes you know > >what you're doing, and lets you do it uninhibited. > > > > Many thanks, Chris, for the answer. > I ought not to have forgotten that because it is very basic, but I was > confused by the different reaction of DJGPP and MSVC. > > Gallicus.