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.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,bbe592428babd509 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!proxad.net!feeder1-2.proxad.net!newsfeed.straub-nv.de!uucp.gnuu.de!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Integer overflow is int overflow (Re: Web browser in Ada) Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <02c2bf63-260d-4acc-bd58-c8fb8a591ec3@b6g2000yqi.googlegroups.com> <0bf9425c-32a1-4b93-b938-ae4a4e24a761@c21g2000yqk.googlegroups.com> <4bd1b090$0$7651$9b4e6d93@newsspool1.arcor-online.net> <4bd6d6e8$0$6892$9b4e6d93@newsspool2.arcor-online.net> <4bd70325$0$7666$9b4e6d93@newsspool1.arcor-online.net> Date: Tue, 27 Apr 2010 18:13:20 +0200 Message-ID: <1k01d6ghve2o7.15fw3tjmkbb7s.dlg@40tude.net> NNTP-Posting-Date: 27 Apr 2010 18:13:19 CEST NNTP-Posting-Host: aa207649.newsspool2.arcor-online.net X-Trace: DXC=Zih`I2?f``i:i=48;n?Z:`A9EHlD;3Ycb4Fo<]lROoRa8kF On Tue, 27 Apr 2010 17:30:44 +0200, Georg Bauhaus wrote: > My conclusions would be that: > > Standard.Integer is a constrained subtype. Its objects are > not like (what is commonly known as) integers, a set that can > be extended at will. The set of integers is not extensible "at will." You probably meant that for any integer there exists at least one [actually an infinitely countable set] of greater or lesser integers. Nevertheless the set of integers (Z) is fixed. Standard.Integer is not an integer, it is a type, used to model integers or other entities. It is not Z independently on how adequately it models the latter. > They cannot overflow in Ada mode. There is no wrap-around. > Named numbers of no-name type universal_integer > cannot overflow, their value is determined by the compiler, Their behavior, you mean. The value is determined by the expression and the language rules. > they are not objects, and they can hit compiler capacity limits. Whether they are [run-time] objects is up to compiler. The compiler in Ada has certain freedom to "objectize" and "deobjectize" things. > So neither Standard.Integer nor universal_integer is an integer. See above. They are not per definition. The question how adequately they can model Z, is answered as: neither does it 100%. The domain of either type is finite. Both domains include non-integer ideal elements called "exception propagation" or "compile error." Concerning the latter, for any legal Ada program there can exist a compiler capable to compile it without error [if you have enough material and time]. > Nor is C's int. Still assuming C's int is like integers, > encouraged by how "int" and "integer" are used interchangeably > in talks and writings, leads to to overflow (this is my > hypothesis). You need overflow in order to define the behavior of the operations closed only in Z. E.g. "+". -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de