Re: [BLACKBOX] Overflow checking

From: [at]} <Robert>
Date: Tue, 18 Oct 2011 20:38:07 +0100


Chris

I have a slightly less catastrophic way of checking the overflow bit:

 

My 'Docu' entry for this is

 

To be honest I have never had reason to use the Overflow flag, but I do use the Carry flag. I also have
(1-byte) procedures for setting and clearing the Carry flag.


Cheers

Robert


On 18/10/2011 08:37 AM, Chris Burrows wrote:

-----Original Message-----

From: BlackBox [mailto:BLACKBOX{([at]})nowhere.xy

Treutwein Bernhard

Sent: Tuesday, 18 October 2011 12:11 AM

To: BLACKBOX{([at]})nowhere.xy

Subject: [BLACKBOX] FW: [BLACKBOX] Type transfer




I don't know why overflow checks are disabled by default. Do

they really add such an overhead that it is worth to disable them?





Overhead is the not the only issue that needs to be considered. From the BB

Help file:



"Safety-critical runtime checks are always performed (type guards, array

range checks, etc.), while non-critical runtime checks may not be generated

(SHORT, integer overflows, testing of set membership). "Critical" means that

non-local memory may be destroyed, with unknown global effects."



Critical checks are absolutely necessary; indiscriminate overflow-checking


is not necessarily a good thing. There are some occasions when overflow

trapping might be useful and others where it should not be done. Some good

examples are here:



http://www.codeproject.com/KB/cs/overflow_checking.aspx



A quick test with the following example shows that it might be a useful

technique for doing specific overflow tests where they are really needed in

a program:



MODULE TestOverflow;



IMPORT SYSTEM;



PROCEDURE [code] ChkOverflow()

0CEH;

                


PROCEDURE Do*;

VAR

  n : INTEGER;

BEGIN

  n := 100000;

  n := n * n;

  ChkOverflow;

END Do;



END TestOverflow.



Cheers,

Chris



Chris Burrows

CFB Software

Astrobe: ARM Oberon Development System

http://www.astrobe.com





----
To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to LISTSERV{([at]})nowhere.xy-----
No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.1831 / Virus Database: 2092/4558 - Release Date: 10/17/11
---- To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to LISTSERV{([at]})nowhere.xy
Received on Tue Oct 18 2011 - 21:38:07 UTC

This archive was generated by hypermail 2.3.0 : Thu Sep 26 2013 - 06:30:10 UTC