comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Integer overflow is int overflow (Re: Web browser in Ada)
Date: Tue, 27 Apr 2010 18:13:20 +0200
Date: 2010-04-27T18:13:19+02:00	[thread overview]
Message-ID: <1k01d6ghve2o7.15fw3tjmkbb7s.dlg@40tude.net> (raw)
In-Reply-To: 4bd70325$0$7666$9b4e6d93@newsspool1.arcor-online.net

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



  reply	other threads:[~2010-04-27 16:13 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-23  8:03 Web browser in Ada Gautier write-only
2010-04-23 13:56 ` Maciej Sobczak
2010-04-23 14:37   ` Georg Bauhaus
2010-04-27 11:41     ` Martin Krischik
2010-04-27 12:22       ` Georg Bauhaus
2010-04-27 14:00         ` AdaMagica
2010-04-27 15:30           ` Integer overflow is int overflow (Re: Web browser in Ada) Georg Bauhaus
2010-04-27 16:13             ` Dmitry A. Kazakov [this message]
2010-04-27 17:09               ` Georg Bauhaus
2010-04-27 17:56                 ` Dmitry A. Kazakov
2010-04-23 21:33   ` Web browser in Ada Gautier write-only
2010-04-24  0:38     ` Peter C. Chapin
2010-04-25  5:38       ` Gautier write-only
2010-04-25 16:24         ` Peter C. Chapin
2010-04-25 10:41       ` Georg Bauhaus
2010-04-25 16:29         ` Peter C. Chapin
2010-04-26 15:37       ` Warren
2010-04-24  9:51 ` leonid
2010-04-25  5:04   ` Gautier write-only
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox