Re: [BLACKBOX] Overflow checking (was: Type transfer)

From: [at]} <Chris>
Date: Tue, 18 Oct 2011 18:07:28 +1030

----boundary-LibPST-iamunique-170396422_-_-
Content-type: text/plain

>-----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----boundary-LibPST-iamunique-170396422_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"
e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZnJvbXRleHQgXGRlZmYwe1xmb250dGJsDQp7XGYwXGZz
d2lzcyBBcmlhbDt9DQp7XGYxXGZtb2Rlcm4gQ291cmllciBOZXc7fQ0Ke1xmMlxmbmlsXGZjaGFy
c2V0MiBTeW1ib2w7fQ0Ke1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XINCjBD
RUg7XHRhYiBccGFyDQpcdGFiIFx0YWIgXHBhcg0KUFJPQ0VEVVJFIERvKjtccGFyDQpWQVJccGFy
DQogIG4gOiBJTlRFR0VSO1xwYXINCkJFR0lOXHBhcg0KICBuIDo9IDEwMDAwMDtccGFyDQogIG4g
Oj0gbiAqIG47XHBhcg0KICBDaGtPdmVyZmxvdztccGFyDQpFTkQgRG87XHBhcg0KXHBhcg0KRU5E
IFRlc3RPdmVyZmxvdy5ccGFyDQpccGFyDQpDaGVlcnMsXHBhcg0KQ2hyaXNccGFyDQpccGFyDQpD
aHJpcyBCdXJyb3dzXHBhcg0KQ0ZCIFNvZnR3YXJlXHBhcg0KQXN0cm9iZTogQVJNIE9iZXJvbiBE
ZXZlbG9wbWVudCBTeXN0ZW1ccGFyDQpodHRwOi8vd3d3LmFzdHJvYmUuY29tXHBhcg0KXHBhcg0K
XHBhcg0KLS0tLVxwYXINClRvIHVuc3Vic2NyaWJlLCBzZW5kIGEgbWVzc2FnZSB3aXRoIGJvZHkg
IlNJR05PRkYgQkxBQ0tCT1giIHRvIExJU1RTRVJWQExJU1RTLk9CRVJPTi5DSFx9fQA6IEM=
----boundary-LibPST-iamunique-170396422_-_---
Received on Tue Oct 18 2011 - 09:37:28 UTC

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