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=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,da29ac1b3f986998,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1994-12-05 10:44:58 PST Newsgroups: comp.lang.ada Path: bga.com!news.sprintlink.net!howland.reston.ans.net!gatech!newsxfer.itd.umich.edu!zip.eecs.umich.edu!panix!news.mathworks.com!noc.near.net!inmet!dsd!bobduff From: bobduff@dsd.camb.inmet.com (Bob Duff) Subject: Re: intermediate results causing constraint errors Message-ID: Sender: news@inmet.camb.inmet.com Organization: Intermetrics, Inc. References: <3bn3l9$pa2@gnat.cs.nyu.edu> Date: Mon, 5 Dec 1994 18:41:31 GMT Date: 1994-12-05T18:41:31+00:00 List-Id: In article <3bn3l9$pa2@gnat.cs.nyu.edu>, Robert Dewar wrote: >Richard Riehl worries about "constraint errors in intermediate results >in expressions of mixed type" > >What's *that* about? > >Ada gives you complete control over the type of all intermediate results, Robert, I didn't see Richard Riehl's comment, but I don't understand your point. If I write: type T is range 1..10_000; X: T := 10_000; Five: T := 5; Ten: T := 10; ... X := (X * Five) / Ten; one implementation might overflow on the multiply and another might not. It's true that there are ways to avoid this (define a wider-ranged type first, and define T as a subtype of that), but I would say that that requires some "Ada experience". Furthermore, the Ada compiler won't necessarily tell you about the problem, either at compiler or run-time -- you'll find out when you try to port the code from a 32-bit machine to a 16-bit machine (a rarity these days, I suppose). >and you only get constraint error if you choose the wrong type. It would >be wrong for *any* language not to give this kind of control. I simply >don't see *any* problem here, and certainly I don't see a problem that >needs the expertise of "experienced Ada" programmers to deal with it. - Bob -- Bob Duff bobduff@inmet.com Oak Tree Software, Inc. Ada 9X Mapping/Revision Team (Intermetrics, Inc.)