From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,7b5a39957e6a4d01 X-Google-Attributes: gid103376,public From: dewar@cs.nyu.edu (Robert Dewar) Subject: Re: Protected Type Question Date: 1996/03/20 Message-ID: #1/1 X-Deja-AN: 143460145 references: <31502A7B.2885@std.caci.com> organization: Courant Institute of Mathematical Sciences newsgroups: comp.lang.ada Date: 1996-03-20T00:00:00+00:00 List-Id: 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.