Taken straight from http://www.digitalmars.com/d/1.0/arrays.html, this doesn't 
compile:

    void main()
    {
        string str = "abc";
        char* p = str;          // pointer to 1st element
    }

"Error: cannot implicitly convert expression (str) of type char[] to char*"

I agree it shouldn't compile; I guess I'm asking why the docs say it does.

While I'm at it, what's up with the very first strings example:

    char[] str;
    char[] str1 = "abc";
    str[0] = 'b';        // error, "abc" is read only, may crash

Should that just be:

    char[] str = "abc";
    str[0] = 'b';        // error, "abc" is read only, may crash


Reply via email to