foreach problem
    Dejan Lekic 
    dejan.lekic at gmail.com
       
    Fri Jan  5 11:57:34 PST 2007
    
    
  
Mr/Mrs BCS,
here is the part of documentation i maybe did not understand well:
----------------- snip ------------------
ForeachStatement:
    Foreach (ForeachTypeList; Aggregate) ScopeStatement
Foreach:
    foreach
    foreach_reverse
ForeachTypeList:
    ForeachType
    ForeachType , ForeachTypeList
ForeachType:
    inout Type Identifier
    Type Identifier
    inout Identifier
    Identifier
----------------- snip ------------------
If I understand this correctly, than simple code like the one in foreach_bug.d
should work because 'arg' is clearly an 'Identifier' from the 'ForeachType' rule
above.
I am posting foreach_bug.d again here:
-- foreach_bug.d ---------8<------------------------------------------
import std.stdio;
int main(char[][] args) {
  char[] arg;
  foreach (arg; args)  // <-- problem here
    writefln(arg);
  return 0;
}
    
    
More information about the Digitalmars-d-bugs
mailing list