disabling unary "-" for unsigned types

Walter Bright newshound1 at digitalmars.com
Tue Feb 16 10:43:08 PST 2010


dsimcha wrote:
> I **HATE** this example because it's a classic example of extreme nitpicking.  On
> most modern computers, (void*).sizeof == size_t.sizeof.  Furthermore, usually half
> your address space is reserved for kernel use.  Therefore, this bug would only
> show up when you're searching an array of bytes **and** very close to exhausting
> available address space (i.e. when you probably have bigger problems anyhow).  I
> have intentionally written binary searches like this even though I'm aware of this
> bug because it's more readable and efficient than doing it "right" and would only
> fail in corner cases too extreme to be worth considering.

I agree with you that this "bug" is not worth considering, and that if 
you have an array that consumes more than half your address space you 
have other problems that will prevent your program from running.



More information about the Digitalmars-d mailing list