On Mon, 02 Jun 2014 15:21:06 -0400, Logesh Pillay <lp.court.jes...@gmail.com> wrote:

It is common in a recursive function to amend a global array using the function parameter to refer to the element eg

int[10];

void foo (int i) {
   foreach (x; 0 .. 9) {
      t[i] = x;
      foo ();

C in a for loop allows use of t[i] directly as the iterating variable so you don't need the dummy variable x which has no real function.

D does not. The error generated is "no identifier for declarator t[i]". For a long time, I thought that was specific to foreach but the same thing happens with for.

It looks like an unnecessary restriction.  Am I missing something?

Can you post a full compiling example? I can't figure out what you are trying to do with this code.

-Steve

Reply via email to