__has_side_effects
Simen Kjærås
simen.kjaras at gmail.com
Sat Mar 31 20:01:10 UTC 2018
On Saturday, 31 March 2018 at 19:18:24 UTC, Shachar Shemesh wrote:
> struct S {
> int a;
>
> void func(int b) pure {
> // For some strange reason, this is not considered a pure
> violation.
> a+=b;
> }
> }
It's the exact equivalent of this code:
void func(ref S s, int b) pure {
S.a += b;
}
And that code is perfectly pure accordion to D rules - it does
not modify any data not reachable through its arguments.
--
Simen
More information about the Digitalmars-d
mailing list