comp.lang.ada
 help / color / mirror / Atom feed
From: "Jerry van Dijk" <jvandyk@ibm.net>
Subject: Re: Question on modular types
Date: 1997/01/06
Date: 1997-01-06T00:00:00+00:00	[thread overview]
Message-ID: <01bbfbf8$4fda7a40$5f2d5c8b@jerryware> (raw)
In-Reply-To: dewar.852430006@merv



Robert Dewar <dewar@merv.cs.nyu.edu> wrote in article
<dewar.852430006@merv>...

>> "Clearly, all values are invalid, and that without inporting any
>> values from the outside world."

> No! If it is clear to you, you need your Ada prescription fixed :-)

Mmmm, I'm afraid if I asked my docter for that, I might wind up with a
totally different prescription... :-)

>   A := -1;

> -1 is not a literal here, it is an expression, and the unary minus
> operator is a modular unary minus. This is a useful, intended, and
> clearly documented facility.

Yes, I found it:

4.5.4(3): For modular integer types, the unary adding operator -, when
          given a nonzero operand, returns the result of subtracting
          the value of the operand from the modulus; for a zero
          operand, the result is zero.

   type Byte is mod 256;
   A_Byte : Byte;

   A_Byte := -1; -- means A_Byte := Byte (Byte'Modulus - 1);

However, 4.5.4(1) mentions that all unary adding operators have their
conventional
meaning, and since the note is not technically part of the standard,
that leaves
me wondering wat that 'conventional meaning; might be. And
'conventional' to whom ?

Thanks,
Jerry.





  reply	other threads:[~1997-01-06  0:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-01-04  0:00 Question on modular types Jerry van Dijk
1997-01-04  0:00 ` Robert Dewar
1997-01-06  0:00   ` Jerry van Dijk [this message]
1997-01-06  0:00     ` Robert A Duff
1997-01-08  0:00       ` Robert Dewar
1997-01-09  0:00         ` Tucker Taft
1997-01-11  0:00           ` Robert Dewar
1997-01-12  0:00             ` Joel VanLaven
1997-01-09  0:00         ` Robert A Duff
1997-01-06  0:00 ` Joel VanLaven
1997-01-08  0:00 ` Stan and/or Jill Grimes
replies disabled

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