A little story

Tobias Pankrath tobias at pankrath.net
Mon Jun 25 04:21:51 PDT 2012


On Monday, 25 June 2012 at 10:08:03 UTC, Dmitry Olshansky wrote:
> On 25-Jun-12 14:01, bearophile wrote:
>> Tobias Pankrath:
>>
>>> Maybe you should post this to the main newsgroup.
>>
>> I don't know if the main newsgroup is the right place.
>>
>>
>>> I would prefer a switch that does this per scope, i.e:
>>
>> I think both a compiler switch for the compilation unit, and a 
>> scope
>> pragma to enable/disable locally, are useful.
>
> While I think that if you seek anything other then plain fixnum 
> you'd better make wrapper type adding nessary overflow checks. 
> It should be almost as fast as plain fixnum if it's not then 
> it's a bug/feature request for optimizer/inliner.

If you have already written code, it may be cumbersome to port it 
to a wrapper type, if the only thing you want to test is, that it 
does not have overflows.

You can't just do alias MyWrapper!int int; can you?

They are a common source of bugs, detecting those should be made 
easy. I do see this as automatic DbC for build-ins and can not 
see any counter argument that would not equally apply to the 
current DbC state.

Except for the fact, that someone has to implement it.





More information about the Digitalmars-d-learn mailing list