Portability bug in integral conversion

Walter Bright newshound2 at digitalmars.com
Mon Jan 17 00:53:16 PST 2011


Graham St Jack wrote:
> It seems to me that the real problem here is that it isn't meaningful to 
> perform (a-b) on unsigned integers when (a<b). Attempting to clean up 
> the resultant mess is really papering over the problem. How about a 
> runtime error instead, much like dividing by 0?

1. Yes it is meaningful - depending on what you're doing.

2. Such a runtime test is expensive in terms of performance and code bloat.


More information about the Digitalmars-d mailing list