Restricting ++ and --
bearophile
bearophileHUGS at lycos.com
Mon Oct 26 01:58:25 PDT 2009
Kagamin:
> int PreInc(ref int i){ i++; return i; }
> int PostInc(ref int i){ i++; return i-1; }
> y=PreInc(i);
> y=PostInc(i);
>
> just a little more difficult.
That's a vote for my proposal then, because you have shown a way to do the same thing for people that really need to do it.
In D there are often ways to do everything. To help avoid bugs there's no need to totally remove all ways to do something, but to turn them into something explicit and under programmer's control. The idea is to turn places where possible bugs can be hidden into something that can be seen.
Bye,
bearophile
More information about the Digitalmars-d
mailing list