comp.lang.ada
 help / color / mirror / Atom feed
From: Jeffrey Carter <spam@spam.com>
Subject: Re: Problem with protected type
Date: Tue, 25 Nov 2003 18:03:06 GMT
Date: 2003-11-25T18:03:06+00:00	[thread overview]
Message-ID: <uPMwb.14566$n56.8738@newsread1.news.pas.earthlink.net> (raw)
In-Reply-To: <bpvrlt$6cs$1@online.de>

Ekkehard Morgenstern wrote:

>  type CoreEvent is limited private;
> 
>  protected BaseEvent is
>   entry Wait;
>   procedure Signal;
>   procedure ManualMode;
>   procedure AutoMode;
>   procedure Reset;
>   function IsSignaled return Boolean;
>  private
>   EventObject : CoreEvent;
>   ManualReset : Boolean := FALSE;
>  end BaseEvent;
> 
> The compiler reports "premature usage of incomplete type derived from
> "BaseEvent"".

That's not a great error message.

I suspect that your real problem is that you omitted the word "type" 
between "protected" and "Baseevent". "protected Baseevent" declares a 
single protected object; "protected type Baseevent" declares a type 
which may then be used to declare many objects of the type.

A type declaration may include a reference to an incomplete type, such 
as Coreevent. An object declaration may not, since it has to allocate 
space for the components, and the compiler does not yet know how much 
space needs to be allocated for Coreevent.

> Can I use a barrier expression that is doing a function call?

Yes, a barrier can be any boolean expression. If you limit yourself to 
the Ravenscar profile, however, a barrier must be a Boolean component of 
the object.

BTW, I find the Ada way, Base_Event, much easier to read than Baseevent, 
which is what my reformatter does with your kind of identifiers.

-- 
Jeff Carter
"Sheriff murdered, crops burned, stores looted,
people stampeded, and cattle raped."
Blazing Saddles
35




  parent reply	other threads:[~2003-11-25 18:03 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-25 15:15 Problem with protected type Ekkehard Morgenstern
2003-11-25 15:43 ` Ekkehard Morgenstern
2003-11-25 16:06   ` Robert I. Eachus
2003-11-25 18:39     ` Ekkehard Morgenstern
2003-11-26 15:43       ` Robert I. Eachus
2003-11-25 16:45   ` Ludovic Brenta
2003-11-25 18:45     ` Ekkehard Morgenstern
2003-11-25 20:09     ` Randy Brukardt
2003-11-25 18:03 ` Jeffrey Carter [this message]
2003-11-25 18:31   ` Ekkehard Morgenstern
2003-11-26  0:42     ` Jeffrey Carter
replies disabled

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