On 04/29/2013 02:17 PM, 1100110 wrote:
...
What is the difference between const(char)*, and const(char*)?  I have
seen them used pretty much interchangeably...

Are they? Somehow I don't think they are.


Variables of type const(char)* can be mutated, while const(char*) cannot be.

void main(){
    const(char)* a = "123".ptr;
    *a = 2;        // error
    a = "456".ptr; // ok
    const(char*) b = "123".ptr;
    *b = 2;        // error
    b = "456".ptr; // error
}

Reply via email to