comp.lang.ada
 help / color / mirror / Atom feed
* Warning in generic instantiation
@ 1999-05-09  0:00 AG
  1999-05-10  0:00 ` Tucker Taft
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: AG @ 1999-05-09  0:00 UTC (permalink / raw)


Could somebody comment on the following warning
I get from ObjectAda compiler (7.1.105) when trying
that:

generic
 size: positive;
 type item is (<>);
procedure matcher;

procedure matcher is
 type set is array(0..size-1) of item;
 type unit is record
    what: set;    --  *** 1
    end record;
begin
 null;
end;

with matcher;
procedure start is
 type unit is (a, b, c);
 size: positive;
begin
    declare
  procedure match is new matcher(size, unit); -- *** 2
    begin
  null;
    end;
end;

The warning I get at line ***2 is:

LRM:13.3(16),Object does not have a meaningful address,
returning a null address

My questions about that:

1. I don't quite see how 13.3(16) is applicable since I don't
directly use anything mentioned there. Is there something
implicit involved?

2. If line ***1 is replaced with NULL, the warning goes
away. So is the warning due to finalising "set" or due to
declaring "unit"?

3. Generally, what's wrong with the above usage? After
all, those types are declared locally or does it matter?

4. Also, it was only a warning so the program compiles
and links and runs with no run-time errors even if I declare
and use objects of "unit" type. So, what was the warning
all about?

Thanks,
AG





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

* Re: Warning in generic instantiation
  1999-05-09  0:00 Warning in generic instantiation AG
@ 1999-05-10  0:00 ` Tucker Taft
  1999-05-10  0:00 ` AG
  1999-05-10  0:00 ` Robert Dewar
  2 siblings, 0 replies; 4+ messages in thread
From: Tucker Taft @ 1999-05-10  0:00 UTC (permalink / raw)


AG wrote:
> 
> Could somebody comment on the following warning
> I get from ObjectAda compiler (7.1.105) when trying
> that:
> 
> generic
>  size: positive;
>  type item is (<>);
> procedure matcher;
> 
> procedure matcher is
>  type set is array(0..size-1) of item;
>  type unit is record
>     what: set;    --  *** 1
>     end record;
> begin
>  null;
> end;
> 
> with matcher;
> procedure start is
>  type unit is (a, b, c);
>  size: positive;
> begin
>     declare
>   procedure match is new matcher(size, unit); -- *** 2
>     begin
>   null;
>     end;
> end;
> 
> The warning I get at line ***2 is:
> 
> LRM:13.3(16),Object does not have a meaningful address,
> returning a null address

I believe this was due to a bug in the generation of
debugging information.  I believe the problem has been
identified and fixed, though I don't know whether it
has yet been released.  You may safely ignore this warning.

Robert Dewar correctly pointed out in his reply that "Size" is
uninitialized.  Here is the corresponding message you
might receive from a newer Aonix compiler:

example.ada: Warning: line 21 col 13 LRM:13.9.1(9), size is uninitialized
       (In instance of generic matcher at example.ada: line 21 col 34)

> Thanks,
> AG

-- 
-Tucker Taft   stt@averstar.com   http://www.averstar.com/~stt/
Technical Director, Distributed IT Solutions  (www.averstar.com/tools)
AverStar (formerly Intermetrics, Inc.)   Burlington, MA  USA




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

* Re: Warning in generic instantiation
  1999-05-09  0:00 Warning in generic instantiation AG
  1999-05-10  0:00 ` Tucker Taft
  1999-05-10  0:00 ` AG
@ 1999-05-10  0:00 ` Robert Dewar
  2 siblings, 0 replies; 4+ messages in thread
From: Robert Dewar @ 1999-05-10  0:00 UTC (permalink / raw)


In article <3734BB9E.F51ED23B@xtra.co.nz>,
  AG <ang@xtra.co.nz> wrote:
> Could somebody comment on the following warning
> I get from ObjectAda compiler (7.1.105) when trying
> that:
>
> generic
>  size: positive;
>  type item is (<>);
> procedure matcher;
>
> procedure matcher is
>  type set is array(0..size-1) of item;
>  type unit is record
>     what: set;    --  *** 1
>     end record;
> begin
>  null;
> end;
>
> with matcher;
> procedure start is
>  type unit is (a, b, c);
>  size: positive;
> begin
>     declare
>   procedure match is new matcher(size, unit); -- *** 2
>     begin
>   null;
>     end;
> end;
>
> The warning I get at line ***2 is:
>
> LRM:13.3(16),Object does not have a meaningful address,
> returning a null address
>
> My questions about that:
>
> 1. I don't quite see how 13.3(16) is applicable since I don't
> directly use anything mentioned there. Is there something
> implicit involved?
>
> 2. If line ***1 is replaced with NULL, the warning goes
> away. So is the warning due to finalising "set" or due to
> declaring "unit"?
>
> 3. Generally, what's wrong with the above usage? After
> all, those types are declared locally or does it matter?
>
> 4. Also, it was only a warning so the program compiles
> and links and runs with no run-time errors even if I declare
> and use objects of "unit" type. So, what was the warning
> all about?
>
> Thanks,
> AG
>

This program is of course incorrect. The warning from GNAT
immediately identifies the problem:

start.adb:5:17: warning: "size" is never assigned a value

Whether the OO warning is related to this error is not clear.
Most certainly the RM reference is not helpful, since the
warning message is not quite right.



--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---




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

* Re: Warning in generic instantiation
  1999-05-09  0:00 Warning in generic instantiation AG
  1999-05-10  0:00 ` Tucker Taft
@ 1999-05-10  0:00 ` AG
  1999-05-10  0:00 ` Robert Dewar
  2 siblings, 0 replies; 4+ messages in thread
From: AG @ 1999-05-10  0:00 UTC (permalink / raw)


I realize I posted that on the weekend, but there were
quite a few postings since. So, could some of the language
experts comment on the following:


AG wrote:

> Could somebody comment on the following warning
> I get from ObjectAda compiler (7.1.105) when trying
> that:
>
> generic
>  size: positive;
>  type item is (<>);
> procedure matcher;
>
> procedure matcher is
>  type set is array(0..size-1) of item;
>  type unit is record
>     what: set;    --  *** 1
>     end record;
> begin
>  null;
> end;
>
> with matcher;
> procedure start is
>  type unit is (a, b, c);
>  size: positive;
> begin
>     declare
>   procedure match is new matcher(size, unit); -- *** 2
>     begin
>   null;
>     end;
> end;
>
> The warning I get at line ***2 is:
>
> LRM:13.3(16),Object does not have a meaningful address,
> returning a null address
>
> My questions about that:
>
> 1. I don't quite see how 13.3(16) is applicable since I don't
> directly use anything mentioned there. Is there something
> implicit involved?
>
> 2. If line ***1 is replaced with NULL, the warning goes
> away. So is the warning due to finalising "set" or due to
> declaring "unit"?
>
> 3. Generally, what's wrong with the above usage? After
> all, those types are declared locally or does it matter?
>
> 4. Also, it was only a warning so the program compiles
> and links and runs with no run-time errors even if I declare
> and use objects of "unit" type. So, what was the warning
> all about?
>
> Thanks,
> AG





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

end of thread, other threads:[~1999-05-10  0:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-05-09  0:00 Warning in generic instantiation AG
1999-05-10  0:00 ` Tucker Taft
1999-05-10  0:00 ` AG
1999-05-10  0:00 ` Robert Dewar

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