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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,583275b6950bf4e6 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-05-25 03:54:37 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!diablo.theplanet.net!newspeer1-gui.server.ntli.net!ntli.net!news2.euro.net!195.129.110.4.MISMATCH!lnewspeer00.lnd.ops.eu.uu.net!emea.uu.net!server1.netnews.ja.net!pegasus.csx.cam.ac.uk!not-for-mail From: Matthew Woodcraft Newsgroups: comp.lang.ada Subject: Re: Quality systems (Was: Using Ada for device drivers? (Was: the Ada mandate, and why it collapsed and died)) Date: 25 May 2003 11:53:37 +0100 (BST) Organization: Linux Unlimited Message-ID: References: <3ec4b1c9$1@news.wineasy.se> <3ECFF541.1010705@attbi.com> NNTP-Posting-Host: rapun.sel.cam.ac.uk Originator: mattheww@chiark.greenend.org.uk ([193.201.200.170]) Xref: archiver1.google.com comp.lang.ada:37756 Date: 2003-05-25T11:53:37+01:00 List-Id: In article <3ECFF541.1010705@attbi.com>, Robert I. Eachus wrote: >It also seems like a problem that is easy to fix in Ada0Y, if not just >by getting compilers to do the right thing. > >You want to be able to say: > >type Unsigned is range 0..2**32-1; >for Unsigned'Size use 32; I would certainly like to see something of the sort. At the moment, we have: [3.5.4] | 9 A signed_integer_type_definition defines an integer type whose | base range includes at least the values of the simple_expressions and | is symmetric about zero, excepting possibly an extra negative value. | A signed_integer_type_definition also defines a constrained first | subtype of the type, with a range whose bounds are given by the | values of the simple_expressions, converted to the type being | defined. It seems to me that something like your solution three would be needed: >3) Add a pragma Unsigned which has to be used immediately after a type >declaration, and has the semantic effect that negative values of the >type can raise Constraint_Error even on intermediate calculations. In >other words A-B+C could raise an exception if B < A, even if B < A+C. 3.5.4.9 would presumably need to change so that for unsigned types the base range didn't include negative integers? -M-