From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,3ccb707f4c91a5f2 X-Google-Attributes: gid103376,public From: kilgallen@eisner.decus.org (Larry Kilgallen) Subject: Re: Portability of Arithmetic (was: Java vs Ada 95) Date: 1996/10/17 Message-ID: <1996Oct17.131142.1@eisner>#1/1 X-Deja-AN: 190099031 x-nntp-posting-host: eisner.decus.org references: <325D7F9B.2A8B@gte.net> <1996Oct15.174526.1@eisner> x-nntp-posting-user: KILGALLEN x-trace: 845572306/2363 organization: LJK Software newsgroups: comp.lang.ada Date: 1996-10-17T00:00:00+00:00 List-Id: In article , bobduff@world.std.com (Robert A Duff) writes: > In article , Robert Dewar wrote: >> type BT is range 1 .. 200; >> subtype T is BT range 1 .. 100; >> X : T := ...; >> Y : T := ...; >> Average : T := (X + Y)/2; >> >>works fine. You can write invalid Ada code for anything, but doing so >>does not prove anything! > > True, but it's easy to do it wrong, and have it work just fine, and then > find that it doesn't work when you port the code. Do all Ada > programmers understand that the above has to be written as you show > above? I suspect not. But I suspect all Java programmers understand > what the range of int is, and when arithmetic is supposed to work. I suspect _most_ Ada programmers understand the range of Integer in their particular environment and know they are not close. Those who take the trouble to go beyond that simplistic view are as likely to take intermediate result needs into account as not. I suspect a smaller percentage of Java programmers than Ada programmers have gone so far as to consider the range of int or Integer respectively. Larry Kilgallen