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=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI autolearn=unavailable autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,f6204cee2f9f77e2 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-01-19 05:31:16 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!fr.clara.net!heighliner.fr.clara.net!teaser.fr!enst.fr!not-for-mail From: Michal Nowak Newsgroups: comp.lang.ada Subject: Re: Constraint_Error in arithmetic expressions Date: Sun, 19 Jan 2003 14:41:45 +0100 Organization: ENST, France Message-ID: References: Reply-To: vinnie@inetia.pl, "comp.lang.ada mail to news gateway" NNTP-Posting-Host: marvin.enst.fr Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7BIT X-Trace: avanie.enst.fr 1042983075 65282 137.194.161.2 (19 Jan 2003 13:31:15 GMT) X-Complaints-To: usenet@enst.fr NNTP-Posting-Date: Sun, 19 Jan 2003 13:31:15 +0000 (UTC) To: "comp.lang.ada usegroup->mailing list gateway" Return-Path: In-reply-to: X-Mailer: Calypso Version 3.30.00.00 (3) X-BeenThere: comp.lang.ada@ada.eu.org X-Mailman-Version: 2.1 Precedence: list List-Id: comp.lang.ada mail to news gateway List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Xref: archiver1.google.com comp.lang.ada:33205 Date: 2003-01-19T14:41:45+01:00 On 2003-01-12 at 23:37 Robert A Duff wrote: >> Suppose that if I declare: >> type T is range 1 .. 200; >> A : T := 150; >> B : T := 150; >> the compiler may choose 1 byte (0 .. 255) or 2 bytes (0 .. 65535) for >> example, for the base subtype. > >No. "is range" declares a signed integer type, and for signed integers, >the base range is always symmetric about zero (or has an extra negative >value). So the minimal base range the compiler can choose in this case >is -200..200. It can choose a wider range. Compilers usually choose a >range that is supported by the hardware. Oh, in fact, I found appropriate RM section. Now comes another curious question - Why the base range is symmetric about zero? Is it because that it is for signed integer? Are there any reasons for it? I'm asking, because suppose I have a 16 bit machine. Now I want to declare: type T is range 2**16 - 10 .. 2**16 - 1; but it is not possible. However, if the base type could be in range 0 .. 2**16 - 1 it could be possible. Thank you for your previous answer, - Michal "Beyond 100,000 lines of code you should probably be coding in Ada" - P. J. Plauger