7.160 --vla, --no_vla

Enables or disables support for variable length arrays.

Default

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 in Standard C. The option --vla is implicitly selected when the source language is C99.

Note

Memory for variable length arrays is allocated at runtime, on the heap.

Examples

size_t arr_size(int n)
{
    char array[n];          // variable length array, dynamically allocated
    return sizeof array;   // evaluated at runtime
}
Related reference
7.19 --c90
7.20 --c99
7.25 --cpp
Non-ConfidentialPDF file icon PDF versionARM DUI0375E
Copyright © 2007, 2008, 2011, 2012, 2014 ARM. All rights reserved.