cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
General C++ Programming
Why does my compiler let me do this...
Why does my compiler let me do this...
Feb 5, 2013 at 6:44pm UTC
elohssa
(88)
Was reading an article on dynamic memory allocation here...
http://www.cplusplus.com/forum/articles/416/
Why does my compiler (g++ that comes with cygwin) allow me to do this...
#include <cstdlib>
using namespace std;
/*
*
*/
int main(int argc, char** argv) {
int size=10;
int array[size];
return 0;
}
Feb 5, 2013 at 7:17pm UTC
guestgulkan
(2942)
It is allowed in C - and the GCC compiler allows it when compiling C++ code (which I believe is something they should change as it is against C++ standard).
Feb 5, 2013 at 7:41pm UTC
Cubbi
(4774)
GCC has the option
-pedantic
to flag supported deviations from the standard, and
-pedantic-errors
to make those deviations fatal errors.
Topic archived. No new replies allowed.