From: Pablo on
Hi,
I have a function called Answer defined in several packages (each one
is different according to the own package), and each function Answer
is called by a permanent task every cycle. The issue is that when I
compile some packages, the compiler bugs me informing "warning:
declaration of "Answer" hides one at (...)". So, is there a way to
define these overload functions in a "secure" way that I do not need
to use pragma Warnings (OFF) to avoid these warnings?
Thanks
From: Anh Vo on
On May 3, 10:57 am, Pablo <pablit...(a)gmail.com> wrote:
> Hi,
> I have a function called Answer defined in several packages (each one
> is different according to the own package), and each function Answer
> is called by a permanent task every cycle. The issue is that when I
> compile some packages, the compiler bugs me informing "warning:
> declaration of "Answer" hides one at (...)". So, is there a way to
> define these overload functions in a "secure" way that I do not need
> to use pragma Warnings (OFF) to avoid these warnings?
> Thanks

I believe use Clause of more than one package containing function
Answer is involved. The simple fix is to replace use Clause with full
qualification.

Anh Vo
From: Warren on
Anh Vo expounded in news:a4179dee-f23c-489b-9695-
166460597b1b(a)u30g2000prd.googlegroups.com:

> On May 3, 10:57�am, Pablo <pablit...(a)gmail.com> wrote:
>> Hi,
>> I have a function called Answer defined in several packages (each one
>> is different according to the own package), and each function Answer
>> is called by a permanent task every cycle. The issue is that when I
>> compile some packages, the compiler bugs me informing "warning:
>> declaration of "Answer" hides one at (...)". So, is there a way to
>> define these overload functions in a "secure" way that I do not need
>> to use pragma Warnings (OFF) to avoid these warnings?
>> Thanks
>
> I believe use Clause of more than one package containing function
> Answer is involved. The simple fix is to replace use Clause with full
> qualification.
>
> Anh Vo

As a compromise, you can do as I often do. Restrict
your use clause usage to certain declare blocks. But this
still won't work if two or more packages are simultaneously
"used" containing "Answer". But I find this technique
useful for use clausing in a more controlled manner.

procedure Beat_Me_Use_Me is
...
begin
...
declare
use P1;

T1 : P1_Type; -- from P1
begin
Answer(T1); -- P1.Answer
end;
...
end Beat_Me_Use_Me;

Warren