Geschrieben am: 19.11.2012 um 15:03 Uhr
|
|
Die genaue Antwort steht übrigens hier:
http://stackoverflow.com/questions/737240/c-c-array-size-at-run-time-w-o-dynamic-allocation-is-allowed
Zusammenfassung: im C++ Standard funktioniert es nicht, im C99 Standard funktioniert es. Wenn ein C++ Compiler es trotzdem akzeptiert, ist es aus Nettigkeit und nichts worauf du dich verlassen solltest wenn du dein Programm mal in einen anderen Compiler stecken willst.
Außerdem wird das Array dann auf dem Stack erzeugt, was bei großen Arrays zu Absturz oder Fehlfunktion führt.
"It is more important that innocence be protected than it is that guilt be punished." (John Adams)
|