Re: [BLACKBOX] INTEGER Add Has Wrong result

From: Campbell, Robert (SELEX GALILEO, UK) <robert.d.campbell{([at]})nowhere.xy>
Date: Thu, 7 Apr 2011 08:45:01 +0100

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

Hi,

It is a curious inconsistency that INTEGERs overflow
quietly, but LONGINTs cause a TRAP.

ButI would not call it 'Wrong'; decisions have to be taken and
either choice is sometimes useful, sometimes undesirable.

Gardens Point CP, I believe, allows the option to switch this behaviour
on a
PROCEDURE by PROCEDURE basis, which would not be possible if the
behaviour was
specified in the language report, rather than being at the compiler
writer's
discretion.

The GP flexibility is GOOD because it allows more problems to be solved
concisely and efficiently; more 'power'.

The GP flexibility is BAD because you can't understand what the source
code
does by reading it alone, and it is harder to understand when you do
also read
the compiler options.


Regards

Robert

 

>> -----Original Message-----
>> From: BlackBox [mailto:BLACKBOX{([at]})nowhere.xy
>> Of luowy{([at]})nowhere.xy
>> Sent: 06 April 2011 23:25
>> To: BLACKBOX{([at]})nowhere.xy
>> Subject: [BLACKBOX] INTEGER Add Has Wrong result
>>
>>
>> *** WARNING ***
>>
>> This message has originated outside your organisation,
>> either from an external partner or the Global Internet.
>> Keep this in mind if you answer this message.
>>
>>
>> look it:
>>
>> MODULE Test;
>> IMPORT StdLog;
>>
>> PROCEDURE Do*();
>> VAR i,j:INTEGER;l:LONGINT;
>> BEGIN
>> i:=MAX(INTEGER);(* 07FFFFFFH *)
>> j:
>> l:=i+j;(* l should be 080000000L *)
>> StdLog.Int(l);Log.Ln; (* ???? l:= -2147483648;
>> 0FFFFFFFF80000000L *)
>> END Do;
>>
>> END Test.
>>
>>
>> ----
>> To unsubscribe, send a message with body "SIGNOFF BLACKBOX"
>> to LISTSERV{([at]})nowhere.xy
>>
>>
SELEX Galileo Ltd
Registered Office: Sigma House, Christopher Martin Road, Basildon, Essex SS14 3EL
A company registered in England & Wales. Company no. 02426132
********************************************************************
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.
********************************************************************


----
To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to LISTSERV{([at]})nowhere.xy----boundary-LibPST-iamunique-382974263_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"
e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZnJvbXRleHQgXGRlZmYwe1xmb250dGJsDQp7XGYwXGZz
d2lzcyBBcmlhbDt9DQp7XGYxXGZtb2Rlcm4gQ291cmllciBOZXc7fQ0Ke1xmMlxmbmlsXGZjaGFy
c2V0MiBTeW1ib2w7fQ0Ke1xmM1xmbW9kZXJuXGZjaGFyc2V0MCBDb3VyaWVyIE5ldzt9fQ0Ke1xj
b2xvcnRibFxyZWQwXGdyZWVuMFxibHVlMDtccmVkMFxncmVlbjBcYmx1ZTI1NTt9DQpcdWMxXHBh
cmRccGxhaW5cZGVmdGFiMzYwIFxmMFxmczIwIEhpLFxwYXINClxwYXINCkl0IGlzIGEgY3VyaW91
cyBpbmNvbnNpc3RlbmN5IHRoYXQgSU5URUdFUnMgb3ZlcmZsb3dccGFyDQpxdWlldGx5LCBidXQg
TE9OR0lOVHMgY2F1c2UgYSBUUkFQLlxwYXINClxwYXINCkJ1dEkgd291bGQgbm90IGNhbGwgaXQg
J1dyb25nJzsgZGVjaXNpb25zIGhhdmUgdG8gYmUgdGFrZW4gYW5kXHBhcg0KZWl0aGVyIGNob2lj
ZSBpcyBzb21ldGltZXMgdXNlZnVsLCBzb21ldGltZXMgdW5kZXNpcmFibGUuXHBhcg0KXHBhcg0K
R2FyZGVucyBQb2ludCBDUCwgSSBiZWxpZXZlLCBhbGxvd3MgdGhlIG9wdGlvbiB0byBzd2l0Y2gg
dGhpcyBiZWhhdmlvdXJccGFyDQpvbiBhXHBhcg0KUFJPQ0VEVVJFIGJ5IFBST0NFRFVSRSBiYXNp
cywgd2hpY2ggd291bGQgbm90IGJlI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PWCIgdG8gTElTVFNFUlZATElTVFN9fQAKTGlz
dC1Pd25lcjogPA=
----boundary-LibPST-iamunique-382974263_-_---
Received on Thu Apr 07 2011 - 09:45:01 UTC

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