I know that if you set a dynamic value in c / C ++, you cannot use this value in brackets to highlight an array (which would make it the so-called variable length array (VLA), which the current C ++ standard does not support) ...
see further:
C ++: Variable Length Array
http://en.wikipedia.org/wiki/Variable-length_array
What I did not quite understand (and what I did not see exactly here) is the reason that the GNU c / C ++ compilers ( gcc, g++) are okay using dynamic allocation based on integer value (as far as I can tell) , while this value is a constant in the field of distribution of the array, but Visual Studiodoes not support it and refuses to compile the code, spitting out errors.
eg. ing++
void Foo(const unsigned int bar)
{
double myStuff[bar];
}
... compiles just fine ...
But the same code refuses to compile in VS versions that I used, unless I go to the bar, constin all areas or is #define, static constetc.
, , , GNU , , malloc, -.
:
- (VS GNU) ,
?
- VS,
[] , , const malloc? - - , ,
GNU?