[challenge] Bounded types

Simen kjaeraas simen.kjaras at gmail.com
Mon Oct 11 18:25:08 PDT 2010


Philippe Sigaud <philippe.sigaud at gmail.com> wrote:


> Could you explain what asm { jo overflow;} does?

jo means jump on overflow, and overflow is the targeted label.


>> It uses a mixin to do the check, so the jo instruction works so it  
>> catches
>> wrapping overflow too.
>
> Could you explain that part?

See above.


>> I'm sure it is broken with types other than int right now, but it might  
>> be a
>> starting point.
>
> Some people downthread raise a point about performance. I don't have a
> D compiler right now, do you think you could compare Bounded to a
> regular int, for example?

I'm not sure, but couldn't the checks be debug-only (or non-release only,
if that were possible)?

-- 
Simen


More information about the Digitalmars-d mailing list