Repairing BigInt const

Matthias Walter xammy at xammy.homelinux.net
Sun Nov 21 15:13:45 PST 2010


On 11/21/2010 04:33 PM, Don wrote:
> Matthias Walter wrote:
>> as it seems, the current version of BigInt is not capable of const, i.e.
>> BigInt(1) + const(BigInt)(1) does not work.
>>
>> Is there already an effort to fix this or would it make sense if I had
>> taken some time to create a fix for it? I have no idea of all the asm in
>> the x86 specialization but as const is an interface thing, I should be
>> able to figure out everything without that knowledge. Or are there
>> general design problems, such that this would be a waste of time?
>
> It's been prevented by some compiler bugs. The changes to pure in
> 2.050 were triggered by attempts to make BigInt pure. 2.051 will
> include several fixes to nothrow.
You mean by "making BigInt pure" that all the computation-methods (like
opBinary, etc.) will be pure, right? Or can D structs be pure as well?
(Whatever this would mean...)

>
> Note that const is transitive (unlike C++), so it isn't just an
> interface thing.

That's clear. For "+", I succeeded in making it const, but of course I
had to modify the biguintcore module, too.

So I guess that you will work on BigInt when 2.051 is out and patch it
to work with const and immutable, right? So I have a good chance to have
a fixed version in the next month(s)?!


More information about the Digitalmars-d mailing list