--vla, --no_vla

This option enables or disables support for variable length arrays.

Show/hideDefault

C90 and Standard C++ do not support variable length arrays by default. Select the option --vla to enable support for variable length arrays in C90 or Standard C++.

Variable length arrays are supported both in Standard C and the GNU compiler extensions. The option --vla is implicitly selected either when the source language is C99 or the option --gnu is specified.

Show/hideExample

size_t arr_size(int n)
{
    char array[n];          // variable length array, dynamically allocated
    return sizeof array;   // evaluated at runtime
}

Show/hideSee also

Copyright © 2010-2011 ARM. All rights reserved.ARM DUI 0491F
Non-ConfidentialID091611