Integer overflow and underflow semantics?

via Digitalmars-d digitalmars-d at puremagic.com
Sat Jul 19 12:49:22 PDT 2014


On Saturday, 19 July 2014 at 08:34:39 UTC, Kagamin wrote:
> Can't it simply generate code as is? Seems wasteful to spend 
> compilation time on this.

Not if you want fast code, consider a template with:

if (a.length+M < b.length+N) {}

then you alias b = a in the template instantiation:

if(a.length+M < a.length+N){}

you want this reduced to:

if (M<N){
}

which can be resolved at compile time.


More information about the Digitalmars-d mailing list