Re: inout question

2018-02-13 Thread Steven Schveighoffer via Digitalmars-d-learn
On 2/12/18 12:33 AM, 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)** e

Re: inout question

2018-02-12 Thread ketmar via Digitalmars-d-learn
lobo wrote: sure, i meant that you have to modify the second parameter accordingly. ;-) anyway, it's good that you fixed it.

Re: inout question

2018-02-12 Thread lobo via Digitalmars-d-learn
On Monday, 12 February 2018 at 05:37:23 UTC, ketmar wrote: 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

Re: inout question

2018-02-12 Thread Kagamin via Digitalmars-d-learn
On Monday, 12 February 2018 at 05:33:16 UTC, Norm wrote: I thought inout was supposed to take const or non-const variants, so expected the original const char* s to work. The problem is in argument e: it's mutable, and strtod stores there a part of s, if s is const you end up with const data

Re: inout question

2018-02-11 Thread ketmar via Digitalmars-d-learn
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 callab