title: constant function parameter as a static array size?
body: <p>I am not completely sure why this isn't working</p>
  
  <pre><code>void foo(const int a=10){
      const int b = 10;
      int c[a];
      int d[b];
  }
  </code></pre>
  
  <p>I thought that I say to the compiler the a is constant - I even tell it that default value is 10 :).</p>
  
  <p>Why is he yelling:</p>
  
  <pre><code>1&gt;sum_floats_txt.cpp(105): error C2057: expected constant expression
  1&gt;sum_floats_txt.cpp(105): error C2466: cannot allocate an array of constant size 0
  1&gt;sum_floats_txt.cpp(105): error C2133: 'c' : unknown size
  </code></pre>
  
  <p>I know what it tells me, but I do not know how to do what I want to do:
  - function with static array inside of size dependable on outside constant
  The function is counting something and returning the time spended on the execution (doing it in RTOS).</p>
  
  <p>So I want to call this function with different parameters from main. To find out for which parameter it executes the shortest.</p>
  
  <p>Is the problem in the way the static arrays works? It must have a constant size in the time of compilation. So for different static arrays I must define more of them. </p>
  
  <p>Possible solution is to create more functions or more static arrays with different sizes predefined. And call them one after the other, but there are thousands of different sizes.</p>
  
  <p>I do not want to do the non-automatized iteration to get the best parameters! Could arguments from main passed to the function before execution help?</p>
  
  <p>VS2010 + RTX64 2013 (should not be the problem)
  win7
  thanks!</p>