4 ms·
What is wrong with multi-dimensional arrays in C? It works far better than in C++: void foo(int X, int Y) { double a[X][Y]; .. } In fact, this is one reason
by uecker 3y ago
What is wrong with multi-dimensional arrays in C? It works far better than in C++:
void foo(int X, int Y)
{
double a[X][Y];
..
}
In fact, this is one reason I switched away from C++, because arrays are so bad in C++.
- pjmlp 3y agoThat is a CVE waiting to be exploited.
- uecker 3y agoNo.
- pjmlp 3y agoIt definitely is, given a nice combination of parameter values, stack sizes and careless programming.
- uecker 3y agoIt is not more unsafe than fixed-sized arrays on the stack and stack clash protection (which you need anyway) protects against this. Also if you compare with C++ and use std::vector, surprise, a CVE about to happen: https://godbolt.org/z/cTG71aTsf https://godbolt.org/z/cTG71aTsf (yes, one can activate library assertions, but still - by default - unsafe)