This code:
#include <iostream> using namespace std; int main() { int num; int people[ num ]; cout << people[ 0 ]; cin >> num; }
will throw an error (actually a warning) in g ++ if the -pedantic flag is -pedantic . Warning:
ISO C++ forbids variable length array 'people'
what is right. Using variable length arrays is a GCC extension that disables on -pedantic . Note that successfully compiling with -std=whatever does not guarantee that your code complies with this standard. The std flag is used to enable functions, not to disable them.
source share