- BYTE arithmetic

From: Treutwein Bernhard <"Treutwein>
Date: Wed, 21 Jun 2006 17:23:07 +0200

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

> Is this what the Language Report requires?
>

yes, citing the Language Report:

        The operators +, -, *, and / apply to operands of numeric

        types. The type of the result is REAL if the operation is
        a division (/) or one of the operand types is a REAL.
        Otherwise the result type is SHORTREAL if one of the operand
        types is SHORTREAL, LONGINT if one of the operand types is
        LONGINT, or INTEGER in any other case.

Beware also that the following loops for ever:

VAR
  b : BYTE;
...

FOR b := 0 TO MAX(BYTE) DO
        ...
END

since it is silently wraps according to the definition
of FOR as

temp := end; v := beg;
WHILE v <= temp DO statements; INC(v) END

regards
--
	Bernhard Treutwein, IuK, Ref. III A 3
	Bernhard.Treutwein(at)verwaltung uni-muenchen de
> -----Original Message-----
> From: blackbox{([at]})nowhere.xy> Behalf Of Campbell, Robert D (SELEX) (UK Edinburgh)
> Sent: Wednesday, June 21, 2006 4:17 PM
> To: BlackBox Mailing List
> Subject: [BlackBox] - BYTE arithmetic
> 
> 
> 
> Hi,
> 
> I was surprised to find that the
> Following code does not compile:
> 
> VAR
>   b : BYTE;
> BEGIN
>   b  :=  -b
> 
> 
> Same thing with SHORTINTs.
> 
> Is this what the Language Report requires?
> 
> Robert
> 
> (PS - I have not tried this on the Gardens Point
> Compiler!)
> 
> ********************************************************************
> This email and any attachments are confidential to the 
> intended recipient and may also be privileged. If you are not 
> the intended recipient please delete it from your system and 
> notify the sender. You should not copy it or use it for any 
> purpose nor disclose or distribute its contents to any other person.
> ********************************************************************
> 
> --- BlackBox
> --- send subject HELP or UNSUBSCRIBE to blackbox{([at]})nowhere.xy> 
> 
--- BlackBox
--- send subject HELP or UNSUBSCRIBE to blackbox{([at]})nowhere.xy----boundary-LibPST-iamunique-1883570151_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"
e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZnJvbXRle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cg0KPiAtLS0gQmxhY2tCb3hccGFyDQo+IC0tLSBzZW5k
IHN1YmplY3QgSEVMUCBvciBVTlNVQlNDUklCRSB0byBibGFja2JveEBvYmVyb24uY2hccGFyDQo+
IFxwYXINCj4gXHBhcg0KXHBhcg0KLS0tIEJsYWNrQm94XHBhcg0KLS0tIHNlbmQgc3ViamVjdCBI
RUxQIG9yIFVOU1VCU0NSSUJFIHRvIGJsYWNrYm94QG9iZXJvbi5jaFxwYXINCn19AGsNCk0
----boundary-LibPST-iamunique-1883570151_-_---
Received on Wed Jun 21 2006 - 17:23:07 UTC

This archive was generated by hypermail 2.3.0 : Thu Sep 26 2013 - 06:27:50 UTC