Subject: | |
From: | |
Reply To: | C. Daniel Cooper |
Date: | Sat, 22 Apr 2000 06:04:54 -0700 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
> The next paragraph (9.5.1(2)) says that it
> is illegal to write components of a protected object in a protected
> function.
>
> His code does so in four places. Thus it is out and out illegal. It doesn't
> compile with GNAT, but it does compile with at least one other compiler I
> tried. (And presumably the one he is using as well).
The Rational Apex compiler also correctly flags the four violations. But
if he's using the compiler I think he is, the solution is to stay away
from "single_protected_declarations", ie, use only a protected type for
declaring a protected object; for some reason this avoids the bug. Thus,
after making the following changes, the compiler should correctly flag
the illegal assignments (the added word TYPE is capitalized below):
protected TYPE Protected_Collection_TYPE is --> make into type
function Destroy return natural;
procedure Dispose_Item(the_Pointer : in out Pointer);
function New_Item return Pointer;
function Size return natural;
private
garbage_Collector : Pointer := null;
garbage_Collector_Count : natural := 0;
end Protected_Collection;
Protected_Collection : Protected_Collection_TYPE; --> use the type
--
C. Daniel Cooper ==========v=================v=======================v
Adv Computing Technologist | processes | All opinions are mine |
206-655-3519 | + architectures | and may not represent |
[log in to unmask] | = systems | those of my employer. |
===========================^=================^=======================^
|
|
|