0
Is bound checking in c++ language possible or not?
Can we insert elements in an array more than its size?
2 ответов
0
Yes, you can and the compiler will quite happily allow it in both C/C++.
C/C++ always errs on the side of max performance, so it considers the costs of automatic bounds checking inserted by the compiler as too high.
This is perfectly legal C/C++:
int* p = new int[10] ;
for(int i=0; I < 1000; i++)
*(p+i) = 5+i;
But you can always roll your own bounds checking if required.
0
Thanks