[challenge] Bounded types

Philippe Sigaud philippe.sigaud at gmail.com
Mon Oct 11 18:41:52 PDT 2010


On Tue, Oct 12, 2010 at 03:25, Simen kjaeraas <simen.kjaras at gmail.com> wrote:

Simen, I'm pretty sure you should be asleep right now. I know *I* should.

>> Could you explain what asm { jo overflow;} does?
>
> jo means jump on overflow, and overflow is the targeted label.

OK. So it checks something somewhere to see if an overflow flag is set
and if so, it jumps on the label. Get it.


>> 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)?

I'm not sure about that: I see Bounded as a type-level garanty that
the passed in value won't be out of bound. But I can see why some
people would like this kind of checks to be disabled in some versions.


More information about the Digitalmars-d mailing list