comp.lang.ada
 help / color / mirror / Atom feed
From: dewar@cs.nyu.edu (Robert Dewar)
Subject: Re: Protected Type Question
Date: 1996/03/20
Date: 1996-03-20T00:00:00+00:00	[thread overview]
Message-ID: <dewar.827372649@schonberg> (raw)
In-Reply-To: 31502A7B.2885@std.caci.com

Bill said

"  procedure Test is

    protected type Sensor (Sensor_Address : System.Address) is
      function Get_Value return Integer;
    private
      The_Sensor : Integer;
      for The_Sensor'Address use Sensor_Address;
    end Sensor;
    ...
    Sensor1 : Sensor(..);
  begin
    ...
  end Test;

GNAT bombs on this incorrectly stating 'missing "end Sensor"' which throws the r
est of the
compilation out of whack.  I'm pretty sure this is NOT legal anyway."

The latest version of GNAT says

     8.       for The_Sensor'Address use Sensor_Address;
              |
        >>> representation clause not allows in protected definition

which is a little politer! But the point GNAT makes is right, and as Bill
suspected, his first attempt is illegal.

THe second attempt is legal, but it places the entire object at the
given address, including locks etc.

A much better approach is to define the variable OUTSIDE the protected
object, and just use the procted object aas a lock.





  reply	other threads:[~1996-03-20  0:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-03-20  0:00 Protected Type Question Bill Pritchett
1996-03-20  0:00 ` Robert Dewar [this message]
  -- strict thread matches above, loose matches on Subject: below --
2000-12-12  1:45 Beard, Frank
2000-12-12  2:51 ` Robert Dewar
     [not found] <B6A1A9B09E52D31183ED00A0C9E0888C46992F@nctswashxchg.nctswash.navy.mil>
2000-12-12  3:39 ` tmoran
2000-12-12  5:49 Beard, Frank
2000-12-12 10:54 ` Robert Dewar
2000-12-12  6:43 Beard, Frank
2000-12-13 23:23 Beard, Frank
2004-01-03 20:58 protected type question shoko
2004-01-04  0:50 ` James Rogers
2004-01-04  1:04 ` Robert I. Eachus
replies disabled

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