- BYTE arithmetic

From: Treutwein Bernhard <"Treutwein>
Date: Thu, 22 Jun 2006 08:37:19 +0200

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

Hi Rex,

[...]
> >Beware also that the following loops for ever:
> >
> >VAR
> > b : BYTE;
> >FOR b := 0 TO MAX(BYTE) DO
>
> This seems to me like an error in the language
> specification, but in any case it can be trapped by integer
> overflow checking, which can be implemented with compiler option '+'.
>

when I encountered it (years ago), there was no hint
about how to enable overflow checking ...

The point is: INC(b) returns BYTE as opposed
to b := b + 1 which produces a compiler error since
b + 1 is INTEGER. In the latter case you have to explicitely
use SHORT(SHORT(b+1)) to get it to compile.

At least the possible (silent? by default) loss of digits is
labeled in the latter case.

regards
--
	Bernhard Treutwein, IuK, Ref. III A 3
	Bernhard.Treutwein(at)verwaltung uni-muenchen de
--- BlackBox
--- send subject HELP or UNSUBSCRIBE to blackbox{([at]})nowhere.xy----boundary-LibPST-iamunique-5748438_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"
e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZnJvbXRleHQgXGRlZmYwe1xmb250dGJsDQp7XGYwXGZz
d2lzcyBBcmlhbDt9DQp7XGYxXGZtb2Rlcm4gQ291cmllciBOZXc7fQ0Ke1xmMlxmbmlsXGZjaGFy
c2V0MiBTeW1ib2w7fQ0Ke1xmM1xmbW9kZXJuXGZjaGFyc2V0MCBDb3VyaWVyIE5ldzt9fQ0Ke1xj
b2xvcnRibFxyZWQwXGdyZWVuMFxibHVlMDtccmVkMFxncmVlbjBcYmx1ZTI1NTt9DQpcdWMxXHBh
cmRccGxhaW5cZGVmdGFiMzYwIFxmMFxmczIwIEhpIFJleCxccGFyDQpccGFyDQpbLi4uXVxwYXIN
Cj4gPkJld2FyZSBhbHNvIHRoYXQgdGhlIGZvbGxvd2luZyBsb29wcyBmb3IgZXZlcjpccGFyDQo+
ID5ccGFyDQo+ID5WQVJccGFyDQo+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