[Issue 11188] std.math.abs fails for shared, const or immutable BigInt types

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Oct 10 11:36:04 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=11188



--- Comment #3 from hsteoh at quickfur.ath.cx 2013-10-10 11:36:03 PDT ---
(In reply to comment #2)
> I'll give that a go and if it works, send a patch to Phobos.  Thanks for the
> thought.  Incidentally, shouldn't "in" be sufficient there for the input?

In this case, you need inout, because you want to propagate the incoming
qualifiers to the output: if x>=0, then you're returning x again, so the return
type needs to carry whatever qualifiers x had on entering the function.
Everything implicitly converts to const, of course, but it would suck if you
returned const and the caller passed in unqual, and now after calling abs he
can't modify the BigInt anymore!

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list