title: Aggregates in c++
body: <p>In the following code why is that  the two statements are illegal</p>
  
  <pre><code>const int i[] = { 1, 2, 3, 4 };
  
  // float f[i[3]]; // Illegal
  
  struct S { int i, j; };
  const S s[] = { { 1, 2 }, { 3, 4 } };
  //double d[s[1].j]; // Illegal
  int main() {} 
  </code></pre>
  
  <p>Why are they illegal? The textual definition is as follows which i didn't understand.</p>
  
  <blockquote>
    <p>"In an array definition, the compiler must be able to generate code
    that moves the stack pointer to accommodate the array. In both of the
    illegal definitions above, the compiler complains because it cannot
    find a constant expression in the array definition."</p>
  </blockquote>
  
  <p>Thanks in advance.</p>