comp.lang.ada
 help / color / mirror / Atom feed
From: stt@spock.camb.inmet.com (Tucker Taft)
Subject: Re: Static in 9X
Date: Thu, 15 Sep 1994 15:05:43 GMT
Date: 1994-09-15T15:05:43+00:00	[thread overview]
Message-ID: <Cw6F9K.n57@inmet.camb.inmet.com> (raw)
In-Reply-To: 940914130023_73672.2025_DHR31-2@compuserve.com

In article <940914130023_73672.2025_DHR31-2@compuserve.com>,
Ken Garlington  <73672.2025@COMPUSERVE.COM> wrote:

>I'm trying to work a problem with my Ada vendor, and time is short, so I would
>appreciate any help I can get in the next day or so. Part of my problem is
>understanding the definition of "static" in the 9XRM 4.9. Which (if any) of the
>following are static, and under what conditions/assumptions? (Assume that
>exceptions are not a factor.)
>
>1. A constant composite value, with static initial values, e.g.
>
>   type R is record
>     X : INTEGER;
>     Y : INTEGER;
>   end record;
>
>   REC : constant R := (1,2); -- static?

No.

>2. Components of a record/elements of an array, e.g.
>
>   V : constant INTEGER := REC.X; -- static?

No.

>3. A user-written function, e.g.
>
>   function Z return INTEGER is begin return 0; end; -- static?

No.

>4. Type conversions that require manipulation of the form of the data; e.g.
>
>   X : constant FLOAT := 0.0;
>   Y : constant LONG_FLOAT := LONG_FLOAT(X); -- static?

Yes, this is one of the changes in Ada 9X (see below).

>5. UNCHECKED_CONVERSIONs?

No.

The interesting changes in type conversions from Ada 83 can be 
summarized as follows:

  1) Type conversions are static if the target is a static scalar 
     subtype and the operand is static;

  2) Short circuit operations are static if the operands are both
     (potentially) static;

  3) Membership tests are static if the operand is static and
     the range or subtype is static;

  4) String literals and concatenations of static operands returning
     a string type are static (but 'value and 'image are never
     static).

  5) The bounds/length of an array object or array subtype are static
     if the object/subtype is statically constrained.
     

This is enumerated in the AARM-4.9(41.a .. 47.a);5.0.

If you don't want to wade your way through the AARM for this,
you can look at the "Changes from Ada 83 to Ada 9X" document
available on ajpo.sei.cmu.edu in public/ada9x/rm9x/v5.0/ch83_9x.{doc,ps}

>Thanks in advance for anyone who can help.
>
>
>Ken Garlington
>Lockheed Fort Worth Company

S. Tucker Taft    stt@inmet.com
Ada 9X Mapping/Revision Team
Intermetrics, Inc.
Cambridge, MA  02138



       reply	other threads:[~1994-09-15 15:05 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <940914130023_73672.2025_DHR31-2@compuserve.com>
1994-09-15 15:05 ` Tucker Taft [this message]
1994-09-16 10:26   ` Static in 9X Tucker Taft
1994-09-19 23:40 Ken Garlington
  -- strict thread matches above, loose matches on Subject: below --
1994-09-16  3:03 Ken Garlington
1994-09-17  3:13 ` Robert Dewar
1994-09-14 13:00 Ken Garlington
1994-09-15 13:37 ` Robert Dewar
replies disabled

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