comp.lang.ada
 help / color / mirror / Atom feed
* Static in 9X
@ 1994-09-14 13:00 Ken Garlington
  1994-09-15 13:37 ` Robert Dewar
  0 siblings, 1 reply; 7+ messages in thread
From: Ken Garlington @ 1994-09-14 13:00 UTC (permalink / raw)


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?

2. Components of a record/elements of an array, e.g.

   V : constant INTEGER := REC.X; -- static?

3. A user-written function, e.g.

   function Z return INTEGER is begin return 0; end; -- static?

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?

5. UNCHECKED_CONVERSIONs?


Thanks in advance for anyone who can help.


Ken Garlington
Lockheed Fort Worth Company



^ permalink raw reply	[flat|nested] 7+ messages in thread
[parent not found: <940914130023_73672.2025_DHR31-2@compuserve.com>]
* Re: Static in 9X
@ 1994-09-16  3:03 Ken Garlington
  1994-09-17  3:13 ` Robert Dewar
  0 siblings, 1 reply; 7+ messages in thread
From: Ken Garlington @ 1994-09-16  3:03 UTC (permalink / raw)


Robert Dewar <dewar@CS.NYU.EDU> writes on Thu, 15 Sep 1994 09:37:32:

<< I don't see that an Ada vendor is particularly in the business of
interpreting language rules like this >>

Our vendor decides whether or not to put objects in ROM via the definition of
static (in part). We're trying to get better performance in this area for
composite objects.

<< What would be useful is for you to explain why you thought that the
other cases were possibly covered >>

Good question. I don't have the standard in front of me, so I'll have to rely
on memory for some things. I think it says that a name which denotes a scalar
object of a static type with a static value is static. What if the scalar is a
record component?

The discussion on static functions describes predefined functions which have
static arguments. I thought maybe an instantiation of UNCHECKED_CONVERSION
could possibly fit that definition, since UNCHECKED_CONVERSION is predefined.

Most of it was just wishful thinking; that I might not have read something
completely. Records such as:

     type MY_TYPE is record
        X : INTEGER;
        Y : INTEGER;
     end record;

     MY : constant MY_TYPE := (1,2);

just seem so obviously static, in the general (non-Ada) sense of the term, that
I thought there had to be something I'm missing. Similarly, when I look at a
function like

    function ADD ( VALUE : INTEGER ) return INTEGER is
    begin
       return VALUE + 1;
    end;

    V : constant INTEGER := ADD(0);

it seems like ADD(0) should be a static expression. I understand that "static"
in the Ada sense probably wasn't meant to be related to ROMability, but that's
where we are with the vendor at the moment.

The question about type conversions is a little different. The vendor says that
a type conversion that requires manipulation of the data representation can't
be put in ROM. However, 9X seemed to me to define this as static in some cases.
I just wanted to make sure I read it right.



^ permalink raw reply	[flat|nested] 7+ messages in thread
* Re: Static in 9X
@ 1994-09-19 23:40 Ken Garlington
  0 siblings, 0 replies; 7+ messages in thread
From: Ken Garlington @ 1994-09-19 23:40 UTC (permalink / raw)


It appears that both Robert Dewar and Tucker Taft believe that the issue of
whether or not objects can be placed in ROM is generally unrelated to the issue
of whether or not the expression is static. Since we also originally asked our
vendor not to use "static" as a basis for their proposal, we must understand
Ada better than I thought! :)  Now, if we can only get our _vendor_ to accept
this profundity at our next meeting...

While I'm at it, I also wanted to thank Mr. Taft for explaining the difficulty
of optimizing an expression initialized with a previosuly-defined constant
composite/attribute. Although the problem of keeping the composite in memory
long enough wouldn't necessarily be a problem for a VAX/1750A cross-compiler
(generally, the most data that could be in one package on a 1750A is 32K, which
a VAX can certainly support), I can see that the practice of using common
compiler components for multiple host/target combinations would make it
difficult to do this in practice.



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~1994-09-19 23:40 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1994-09-14 13:00 Static in 9X Ken Garlington
1994-09-15 13:37 ` Robert Dewar
     [not found] <940914130023_73672.2025_DHR31-2@compuserve.com>
1994-09-15 15:05 ` Tucker Taft
1994-09-16 10:26   ` Tucker Taft
  -- 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-19 23:40 Ken Garlington

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