|
-
October 10th, 2010, 03:16 PM
#4
Re: 3D array memory allocation dimensions
 Originally Posted by Kositch
cout << test[5][15][5]; //it should say, that i am off the array size with number 5 in depth dimension (program should throw exception),
Where did you get that erroneous information from?
but it will write some random number -21598 and doesnt throw any exception, that i am looking out of allocated memory
Welcome to the world of C++ programming.
When you make a mistake such as writing outside the boundaries of an array in a C++ program, there is nothing that guarantees how your program will behave. The program may throw an exception, or it may work without anything happening, or may throw an exception when run on your machine but run without anything happening on another machine, plain old crash without an exception, etc.
C++ is not Java or C#, or some other computer language that has these checks at runtime and automatically will inform you of a problem.
Regards,
Paul McKenzie
Last edited by Paul McKenzie; October 10th, 2010 at 03:23 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|