inout question

Norm norm.rowtree at gmail.com
Mon Feb 12 05:33:16 UTC 2018


Hi,

I'm new to D so can someone explain to me what is happening here?


void func(const char* s, char** e) {
     import core.stdc.stdlib;
     auto result = strtod(s, e);
}

Error: function core.stdc.stdlib.strtod (scope inout(char)* nptr, 
scope inout(char)** endptr) is not callable using argument types 
(const(char*), char**)

I've found I have to use the following:

void func(inout (char)* s, inout(char)** e)


I thought inout was supposed to take const or non-const variants, 
so expected the original const char* s to work.

Thanks,
Norm


More information about the Digitalmars-d-learn mailing list