Integral overflow, Order relations
Sean Kelly
sean at f4.ca
Sun Aug 19 17:46:01 PDT 2007
bearophile wrote:
> I have used some C in the past, so I really like that D puts some efforts in avoiding some common bugs, like disallowing:
>
> for(i= 0;i<10;i++);
> while(n = func(x)) {}
>
> I have read that in complex C/C++ programs up to 30% of all bugs are caused by integer overflow, so I think D must help the programmer avoid some simple integer bugs too, like:
>
> writefln(-6 >= "abc".length); // Prints: true
There was some discussion about restricting implicit conversions in
expressions a while back. At the time, I thought the changes were
imminent, but they appear to have been forgotten in favor of other
things (the new const features, most likely). So in short, I think
'someday' D will prevent this kind of error from occurring.
Sean
More information about the Digitalmars-d
mailing list