I try to understand, what happens when creating an array of unknown size on stack at compile time. Let consider this code:
int main()
{
int x;
cin >> x;
int tab[x];
}
I found a lot of information about this saying that you can not create an array of unknown size on the stack, but I didn't find any information why does the C++ compiler allows it, or maybe some of them do? What happens when creating such array? Is it even created on stack or already on heap?
Does the GCC compiler have some option to turn on, thanks to which such a constructions would be considered as errors or at least warnings?