noob Q: declaring string variables

Simen kjaeraas simen.kjaras at gmail.com
Sat May 29 23:54:41 PDT 2010


Duke Normandin <dukeofperl at ml1.net> wrote:

> char[] password = "sesame";
>
> didn't work on my MacOS X box. Why?

As others have said, in D2, strings are immutable by default, so

string password = "sesame";
or
immutable(char)[] password = "sesame";

Would be the correct way.

> [sidebar]
> Why is every D tutorial I've touched upon so far, been frigged up?
> This is NOT good advocacy, people! Bad advertising! Where is the good
> stuff hiding? L8r...

One of the reasons probably is the D1/D2 schism. D1 was, in a way, a
hastily chosen point at which to call the language stable. Because
it has been a stable version of the language for three years, D1 has
been the subject of most tutorials, while D2 has been a moving target
and thus any tutorial written for it would soon be outdated.
Hopefully, this situation will change as D2 becomes more stable (it
actually is fairly stable already).

-- 
Simen


More information about the Digitalmars-d-learn mailing list