From: Ted Dennison <dennison@telepath.com>
Subject: Re: Ada vs Delphi?
Date: 1999/08/11
Date: 1999-08-11T00:00:00+00:00 [thread overview]
Message-ID: <7os3tj$bao$1@nnrp1.deja.com> (raw)
In-Reply-To: 37b129ae.43419124@news.total.net
In article <37b129ae.43419124@news.total.net>,
aratel@total.net (Andre Ratel) wrote:
> type
> n1, n2: cardinal;
> N21, N12: integer;
> Now, with the above definitions of variables, a statement like
> N21:= n2 - n1;
> would not be valid with Ada?
It depends on how "cardinal" is defined. If it were defined as a
completely separate type, eg:
type Cardinal is 0..Integer'max;
then no, that would not be allowed. If you wanted to do that you'd have
to be more explicit about it. eg:
N21 := Cardinal(n2 - n1);
And of course the type conversion would probably cause a constraint
check (unless they are turned off, or the compiler can determine ahead
of time that the check will always pass).
However, I could use a "subtype" instead of a completely different
integer type. (I'm not sure if Delphi's "cardinal" includes 0 or not,
but lets assume it does .If not, substitute "Natural" with "Positive"
below). Ada has a predefined subtype of Integer named "Natural" that
achieves the same effect. IAW, the following *is* legal Ada:
n1, n2 : Natural;
N21 := n2 - n1;
So the answer is, it could be either legal or not legal, depending on
how you the developer, want it to be.
--
T.E.D.
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
next prev parent reply other threads:[~1999-08-11 0:00 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-08-06 0:00 Ada vs Delphi? Andre Ratel
1999-08-06 0:00 ` William Starner
1999-08-06 0:00 ` William Starner
1999-08-07 0:00 ` tmoran
1999-08-07 0:00 ` Aidan Skinner
1999-08-07 0:00 ` Gautier
1999-08-06 0:00 ` Steve Doiel
1999-08-09 0:00 ` Paul Groves
1999-08-08 0:00 ` Steve Doiel
1999-08-10 0:00 ` Ray Blaak
1999-08-10 0:00 ` Steve Doiel
1999-08-14 0:00 ` Andre Ratel
1999-08-09 0:00 ` Gautier
1999-08-11 0:00 ` Andre Ratel
1999-08-12 0:00 ` Gautier
1999-08-12 0:00 ` Gautier
1999-08-14 0:00 ` Andre Ratel
1999-08-14 0:00 ` Gautier
1999-08-16 0:00 ` Gautier
1999-08-15 0:00 ` Steve Doiel
1999-08-17 0:00 ` Robert I. Eachus
1999-08-09 0:00 ` Aidan Skinner
1999-08-09 0:00 ` Robert Dewar
1999-08-09 0:00 ` Robert Dewar
1999-08-11 0:00 ` Andre Ratel
1999-08-11 0:00 ` Robert Dewar
1999-08-14 0:00 ` Andre Ratel
1999-08-17 0:00 ` Robert I. Eachus
1999-08-11 0:00 ` Ted Dennison [this message]
1999-08-14 0:00 ` Andre Ratel
1999-08-16 0:00 ` Ted Dennison
1999-08-11 0:00 ` Robert Dewar
1999-08-11 0:00 ` David Botton
1999-08-14 0:00 ` Andre Ratel
1999-08-10 0:00 ` Brian Rogoff
1999-08-11 0:00 ` Scientific calculations (was Re: Ada vs Delphi? ) Vladimir Olensky
1999-08-11 0:00 ` Robert Dewar
1999-08-11 0:00 ` Robert Dewar
1999-08-11 0:00 ` Vladimir Olensky
1999-08-13 0:00 ` Robert Dewar
1999-08-13 0:00 ` Brian Rogoff
1999-08-15 0:00 ` Vladimir Olensky
1999-08-15 0:00 ` Vladimir Olensky
1999-08-13 0:00 ` Gautier
1999-08-11 0:00 ` Ada vs Delphi? Andre Ratel
1999-08-11 0:00 ` Robert Dewar
1999-08-14 0:00 ` Andre Ratel
1999-08-11 0:00 ` Ada vs Component Pascal (was: Ada vs Delphi?) Ted Dennison
1999-08-07 0:00 ` Ada vs Delphi? Gautier
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox