comp.lang.ada
 help / color / mirror / Atom feed
* Got warnings when overriding Initialize and Finalize
@ 2009-07-10 14:16 Hibou57 (Yannick Duchêne)
  2009-07-10 15:34 ` Adam Beneschan
  0 siblings, 1 reply; 5+ messages in thread
From: Hibou57 (Yannick Duchêne) @ 2009-07-10 14:16 UTC (permalink / raw)


Hello,

I got some warnings which still stick to me when I want to override
Initialize and Finalize on controlled types.

Here is a reduced example of the matter :

> with Ada.Finalization;
> package Test is
>    type T is tagged limited private;
> private
>    type T is new Ada.Finalization.Limited_Controlled with null record;
>    overriding procedure Initialize (Object : in out T);
>    overriding procedure Finalize (Object : in out T);
> end Test;

This give me warnings like “ warning: declaration of "Initialize"
hides one at line xxx ” where xxx is the line of “ type T is new
Ada.Finalization.Limited_Controlled with null record; ”. The same
warning appears for Finalize.

If there is no more private part, there is no more warnings. Ex ...

> with Ada.Finalization;
>    type T is new Ada.Finalization.Limited_Controlled with null record;
>    overriding procedure Initialize (Object : in out T);
>    overriding procedure Finalize (Object : in out T);
> end Test;

... does not produce any warnings.

If I do the following, there is no warning as well :

> with Ada.Finalization;
> package Test is
>    type T is new Ada.Finalization.Limited_Controlled with private;
>    overriding procedure Initialize (Object : in out T);
>    overriding procedure Finalize (Object : in out T);
> private
>    type T is new Ada.Finalization.Limited_Controlled with null record;
> end Test;

Is it mandatory to declare overriding of Initialize and Finalize in
the public part and thus to declare the T is an
Ada.Finalization.Limited_Controlled in the public part as well ?

But the Annotated RM contains this small excerpt :

AARM 7.6 17.h.2/1 says:
> package P is
>    type Dyn_String is private;
>    Null_String : constant Dyn_String;
>    ...
> private
>    type Dyn_String is new Ada.Finalization.Controlled with ...
>    procedure Finalize(X : in out Dyn_String);
>    procedure Adjust(X : in out Dyn_String);
>
>    Null_String : constant Dyn_String :=
>       (Ada.Finalization.Controlled with ...);
>    ...
> end P;

So what to think about these warnings ?

Is there something I am not seeing ?



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-07-14 14:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-10 14:16 Got warnings when overriding Initialize and Finalize Hibou57 (Yannick Duchêne)
2009-07-10 15:34 ` Adam Beneschan
2009-07-10 16:12   ` Hibou57 (Yannick Duchêne)
2009-07-11  1:10   ` Randy Brukardt
2009-07-14 14:54     ` Robert A Duff

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