Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Computer Certification > MCSD > VC6 Compiler ignores Array indexing?

Reply
Thread Tools

VC6 Compiler ignores Array indexing?

 
 
Ultraman Aries
Guest
Posts: n/a
 
      06-04-2004
Hi, I'm a newbie VC6 user. I declare an array that holds
5 elements and when I try to put an error for debugging
nothing happens. I will be grateful for your effort.
////Heres d code

int array[5];

for( int i = 0; i < 6; i++ )
array[i] = i;

cout<< array[3] //output: 3 OK!
<< endl
<< array[6]; //output: 6 should be an error!

 
Reply With Quote
 
 
 
 
The Poster Formerly Known as Kline Sphere
Guest
Posts: n/a
 
      06-04-2004
Nope, won't get a compiler error, however you should have had an
warning displayed in the output window after running in debug mode,
warning of a stack corruption (or like off).

So what does this mean? It means C++ is not for children, and by being
so, generates smaller, quicker code than would be the case if it had
to perform bounds checking etc.

On Fri, 4 Jun 2004 13:47:10 -0700, "Ultraman Aries"
<(E-Mail Removed)> wrote:

> Hi, I'm a newbie VC6 user. I declare an array that holds
>5 elements and when I try to put an error for debugging
>nothing happens. I will be grateful for your effort.
>////Heres d code
>
>int array[5];
>
> for( int i = 0; i < 6; i++ )
> array[i] = i;
>
> cout<< array[3] //output: 3 OK!
> << endl
> << array[6]; //output: 6 should be an error!
>



Kline Sphere (Chalk) MCNGP #3
 
Reply With Quote
 
 
 
 
=?Utf-8?B?SSBMb3ZlIEMrKw==?=
Guest
Posts: n/a
 
      06-05-2004
If you think that is screwy, try this (switch name and index)

int array[5]

for( int i = 0; i < 5; i++ )
array[i] = i;

for( int i = 0; i < 5; i++ )
cout << i[array] << endl;

----- Ultraman Aries wrote: ----

Hi, I'm a newbie VC6 user. I declare an array that holds
5 elements and when I try to put an error for debugging
nothing happens. I will be grateful for your effort. ;-
////Heres d cod

int array[5]

for( int i = 0; i < 6; i++ )
array[i] = i;

cout<< array[3] //output: 3 OK
<< end
<< array[6]; //output: 6 should be an error


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Weird C++ Compiler Ignores Errors Immortal Nephi C++ 11 04-20-2010 08:07 AM
VC6 - .net class browsing Ricky Corsi ASP .Net 0 04-13-2005 10:45 PM
const qualifier and VC6.0 Sergey Tolstov C++ 8 10-07-2003 02:42 PM
Re: Is it possible to combine two core exams (.Net & VC6) to get MCSD? Lura Johnson [MSFT] Microsoft Certification 0 08-29-2003 09:34 PM
Is it possible to combine two core exams (.Net & VC6) to get MCSD? Gihan MCSD 1 07-31-2003 07:17 AM



Advertisments