Associative Array Bug?

jicman cabrera_ at _wrc.xerox.com
Mon Jan 29 16:53:03 PST 2007


I have this program,

import std.stdio;
void main()
{
  char[][] t;
  t = [
        "ProjID",
        "id",
        "parent",
        "children",
        "login",
        "cust",
        "proj",
        "class",
        "bdate",
        "ddate",
        "edate",
        "pm",
        "lang",
        "vendor",
        "invoice",
        "ProjFund",
        "A_No",
        "notes",
        "status"
          "should give error"
      ];
  foreach (char[] s; t)
    writefln(s);
  writefln(t.length);
}

and it compiles and runs.  However, I forgot a comma after a status and so the
last two strings get concatenated by the program. ie.

19:46:18.54>testarr
ProjID
id
parent
children
login
cust
proj
class
bdate
ddate
edate
pm
lang
vendor
invoice
ProjFund
A_No
notes
statusshould give error
19

Is this the correct behaviour?  Should not the compiler protest about a
missing comma or a lack of ~?

back to D'ing...

thanks.

josé


More information about the Digitalmars-d-learn mailing list