Norm wrote:
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**)
there is a difference between `const char* s`, and `const(char)* s`.
the former means that both `s` and `*s` cannot change, the latter means
that `s` can be changed, but `*s` cannot. i.e. the first form means that
you cannot do pointer arithmetic with `s`, while with second form you can
(only *contents* are const, not the pointer itself).
that is, `strtod` wants const *contents*, but not pointer. `const(char)* s`.