confused about pure functions
markusle
markus.lists at gmail.com
Sat Mar 17 10:02:56 PDT 2012
Using dmd 2.058 I can compile the following
pure bool has_path(string paths[], string needle) {
paths[0] = "bad";
... do something else ...
return false;
}
and change the passed in array "paths". Isn't this a violation of
has_path's pure contract? Shouldn't all pure function parameters
be passed as "in" to avoid side effects. Sorry if I missed
something obvious.
More information about the Digitalmars-d
mailing list