title: Enabling VLAs (variable length arrays) in MS Visual C++?
body: <p>How can I enable the use of VLAs, variable length arrays as defined in C99, in MS Visual C++ or that is not possible at all?</p>
  <p>Yes I know that the C++ standard is based on C89 and that VLAs are not available in C89 standard and thus aren't available in C++, but MSVC++ is supposed to be a C compiler also, a behavior that can be switched on using the /TC compiler parameter (<code>Compile as C Code (/TC)</code>). But doing so does not seem to enable VLAs and the compiling process fails with the same errors when building as C++ (<code>Compile as C++ Code (/TP)</code>). Maybe MSVC++ C compiler is C89 compliant only or I am missing something (some special construct or pragma/define)?</p>
  <p>Code sample:</p>
  <pre><code>#include &lt;stdlib.h&gt;
  
  int main(int argc, char **argv)
  {
    char pc[argc+5];
  
    /* do something useful with pc */
  
    return EXIT_SUCCESS;
  }
  </code></pre>
  <p>Compile errors:</p>
  <blockquote>
  <p>error C2057: expected constant expression</p>
  <p>error C2466: cannot allocate an array of constant size 0</p>
  <p>error C2133: 'pc' : unknown size</p>
  </blockquote>