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

From: [at]} <Bernhard>
Date: Tue, 18 Oct 2011 10:48:00 +0200

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

> 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
>

good point.

Let me put it this way:

I personally would prefer having them enabled by default.
It would also avoid the endless loop created by:

   VAR
       i : BYTE;

[...]

  FOR i := MIN(BYTE) TO MAX(BYTE) DO
      Something(i)
  END

This loop runs correctly when i is SHORTINT, INTEGER or LONGINT, but loops forever by silently overflowing from MAX(BYTE) to MIN(BYTE) when i is BYTE.

But it is correct that it is difficult to implement special algorithms, which depend on silent overflow, if you cannot control it.

regards
    Bernhard


----
To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to LISTSERV{([at]})nowhere.xy----boundary-LibPST-iamunique-1029708888_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"
e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZnJvbXRleHQgXGRlZmYwe1xmb250dGJsDQp7XGYwXGZz
d2lzcyBBcmlhbDt9DQp7XGYxXGZtb2Rlcm4gQ291cmllciBOZXc7fQ0Ke1xmMlxmbmlsXGZjaGFy
c2V0MiBTeW1ib2w7fQ0Ke1xmM1xmbW9kZXJuXGZjaGFyc2V0MCBDb3VyaWVyIE5ldzt9fQ0Ke1xj
b2xvcnRibFxyZWQwXGdyZWVuMFxibHVlMDtccmVkMFxncmVlbjBcYmx1ZTI1NTt9DQpcdWMxXHBh
cmRccGxhaW5cZGVmdGFiMzYwIFxmMFxmczIwID4gQ3JpdGljYWwgY2hlY2tzIGFyZSBhYnNvbHV0
ZWx5IG5lY2Vzc2FyeTsgaW5kaXNjcmltaW5hdGUgb3ZlcmZsb3ctY2hlY2tpbmdccGFyDQo+IGlz
IG5vdC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WwgYWxnb3JpdGhtcywgd2hpY2ggZGVwZW5kIG9uIHNpbGVudCBvdmVyZmxv
dywgaWYgeW91IGNhbm5vdCBjb250cm9sIGl0LlxwYXINClxwYXINCnJlZ2FyZHNccGFyDQogICAg
QmVybmhhcmRccGFyDQpccGFyDQpccGFyDQotLS0tXHBhcg0KVG8gdW5zdWJzY3JpYmUsIHNlbmQg
YSBtZXNzYWdlIHdpdGggYm9keSAiU0lHTk9GRiBCTEFDS0JPWCIgdG8gTElTVFNFUlZATElTVFMu
T0JFUk9OLkNIfX0ASQAAAA=
----boundary-LibPST-iamunique-1029708888_-_---
Received on Tue Oct 18 2011 - 10:48:00 UTC

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