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-Thread: 103376,78ec96be17741f16 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newscon06.news.prodigy.com!prodigy.net!newsfeed-00.mathworks.com!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Unclear error message - please help Date: 15 Oct 2005 21:10:36 -0400 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <432C8690.C37D4AE0@alfred-hilscher.de> <43482077.3434FCF3@alfred-hilscher.de> <4894486.ZC6T0HgaI8@linux1.krischik.com> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls4.std.com 1129425036 21399 192.74.137.71 (16 Oct 2005 01:10:36 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Sun, 16 Oct 2005 01:10:36 +0000 (UTC) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Xref: g2news1.google.com comp.lang.ada:5716 Date: 2005-10-15T21:10:36-04:00 List-Id: Dennis Lee Bieber writes: > On Mon, 10 Oct 2005 08:02:07 +1000, Brian May > declaimed the following in comp.lang.ada: > > > > > I read the above links but didn't see why a range 0..65535 requires 17 > > bits. > > I haven't dug up the reference books, but I seem to recall that, for > a non-MOD type, the /base/ storage is assumed to be signed. So... > 0..65535 implies a base of -65535..65535; with a run-time check that no > negatives are allowed. > > Ah... Page 39 of my old reference manual > > """ > 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. > """ > > Keywords: base range; symmetric about zero. Right. But don't confuse the base range with the memory size of values/objects of that subtype. The base range determines how arithmetic works: overflow will not happen, so long as you stay within that base range. So, for example, (X+Y)/2 will not overflow, so long as the value of X+Y is within the base range. But the object X might be stored in a smaller number of bits than the base range requires. Normally, the compiler will store X in a register or memory location that matches the base range, for efficiency, but you can request smaller memory size with all kinds of rep clauses/pragmas. Anyway, I think the original post showed a [sub]type derived from Integer, so it will have the same base range as Integer (perhaps 32 bits). - Bob