comp.lang.ada
 help / color / mirror / Atom feed
From: emery@goldfinger.mitre.org (David Emery)
Subject: Re: Type System.ADDRESS
Date: 3 Nov 94 11:27:06
Date: 1994-11-03T11:27:06+00:00	[thread overview]
Message-ID: <EMERY.94Nov3112706@goldfinger.mitre.org> (raw)
In-Reply-To: rgilbert@orl.mmc.com's message of 1 Nov 1994 13:04:11 GMT

>  Any assignments to type System.Address require a static expression.

This sounds like a compiler bug to me.  

First, the following is legal Ada, i.e. you can compute arbitrary
values of type System.address and assign them to variables of the
type: 
  
    X : system.address;
    A, B : integer;
  begin
    if (some_random_event) then
      X := A'address;
    else
      X := B'address;
    end if;
  end;
  
Let's now look at address representation clauses.   For instance,
given Address A, the address of an integer, the following is legal
Ada: 
  
  I : integer;
  for I use at A;

Ada83 (Ada87) RM, 13.5(2) says that the expression must be a
"simple_expression".  This is NOT the same as a
"static_simple_expression" (e.g. 13.4 (2), alignment_clause for a
record representation).  

Therefore the following is legal Ada (although potentially erroneous):
  
  with System;
  function I_at_addr (addr : System.address)
      return integer
  is
     the_object : integer;
     for the_object use at addr;
  begin
     return the_object;
  end;

				dave
--
--The preceeding opinions do not necessarily reflect the opinions of
--The MITRE Corporation or its sponsors. 
-- "A good plan violently executed -NOW- is better than a perfect plan
--  next week"                                      George Patton
-- "Any damn fool can write a plan.  It's the execution that gets you
--  all screwed up"                              James Hollingsworth
-------------------------------------------------------------------------



  parent reply	other threads:[~1994-11-03 11:27 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1994-10-31 20:28 Type System.ADDRESS Bob Gilbert
1994-11-01  3:11 ` Tucker Taft
1994-11-01 13:04   ` Bob Gilbert
1994-11-01 23:04     ` Norman H. Cohen
1994-11-02  5:51     ` Tucker Taft
1994-11-02 15:45       ` Bob Gilbert
1994-11-07 11:22         ` David Emery
1994-11-03 11:27     ` David Emery [this message]
1994-11-03 11:31     ` Robert Dewar
1994-11-03 10:08 ` Robert I. Eachus
1994-11-03 11:30 ` Robert Dewar
1994-11-03 18:23   ` Bob Gilbert
replies disabled

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