primitive value overflow
Marco Leise
Marco.Leise at gmx.de
Thu May 23 15:02:27 PDT 2013
Am Thu, 23 May 2013 19:55:36 +0200
schrieb luka8088 <luka8088 at owave.net>:
> I understand perfectly the issue that you are pointing out. But that is
> not the real issue here. I know how computer arithmetic works, the
> understanding is not the issue here. The real issue is that at the time
> of writing unsigned was never mentioned, and it never came to my mind
> that it could be the issue (until I printed that actual value). So in
> reality I made a mistake, as I sometimes make a typo mistake. And I fix
> them (as I did this one) by debugging.
>
> What I want to point out is that this kind of mistakes can be pointed
> out to the programer in debug mode (and save programer time) by adding a
> runtime check. The only real benefit here would be shorter debug time,
> and the only real tradeoff would be slower executing in debug mode.
> Nothing else.
Ok, I remember that from Delphi
http://docs.embarcadero.com/products/rad_studio/delphiAndcpp2009/HelpUpdate2/EN/html/devcommon/compdirsoverflowchecking_xml.html
It is a good idea and probably better then some Checked!int
construct. Overflows are only wanted in a few places, so it
makes sense to have this check enabled globally and to disable
it for some code locally.
--
Marco
More information about the Digitalmars-d
mailing list