From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: * X-Spam-Status: No, score=1.3 required=5.0 tests=BAYES_00,INVALID_MSGID, MSGID_RANDY autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,114e43c851a0cefb X-Google-Attributes: gid103376,public From: Robert Dewar Subject: Re: Warning in generic instantiation Date: 1999/05/10 Message-ID: <7h5mhj$ce1$1@nnrp1.deja.com>#1/1 X-Deja-AN: 476039555 References: <3734BB9E.F51ED23B@xtra.co.nz> X-Http-Proxy: 1.0 x22.deja.com:80 (Squid/1.1.22) for client 205.232.38.14 Organization: Deja.com - Share what you know. Learn what you don't. X-Article-Creation-Date: Mon May 10 04:15:47 1999 GMT Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/4.04 [en] (OS/2; I) Date: 1999-05-10T00:00:00+00:00 List-Id: In article <3734BB9E.F51ED23B@xtra.co.nz>, 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 > 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.---