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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,a0d43ac4516d0597 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-02-02 11:05:20 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!cyclone.bc.net!sjc70.webusenet.com!news.webusenet.com!newsfeed2.earthlink.net!newsfeed1.earthlink.net!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!newsread1.prod.itd.earthlink.net.POSTED!not-for-mail Message-ID: <3E3D6BDC.1010501@acm.org> From: Jeffrey Carter User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.0.0) Gecko/20020530 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Misleading Compiler Warning References: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Date: Sun, 02 Feb 2003 19:03:53 GMT NNTP-Posting-Host: 63.184.0.182 X-Complaints-To: abuse@earthlink.net X-Trace: newsread1.prod.itd.earthlink.net 1044212633 63.184.0.182 (Sun, 02 Feb 2003 11:03:53 PST) NNTP-Posting-Date: Sun, 02 Feb 2003 11:03:53 PST Organization: EarthLink Inc. -- http://www.EarthLink.net Xref: archiver1.google.com comp.lang.ada:33699 Date: 2003-02-02T19:03:53+00:00 List-Id: Volkert wrote: > pack.adc:9:03: warning: in instantiation at Gen.adc:4 > pack.adc:9:03: warning: value not in range of type "Standard.Integer" > pack.adc:9:03: warning: "Constraint_Error" will be raised at run time This is an unusual warning. However, I think some warning is a good idea; see below. > > generic > type S is private; > package Gen is > > generic > type T is range <>; > package Inner_Gen is > procedure Do_It; > end Inner_Gen; > > end Gen; > > --- > > package body Gen is > > package body Inner_Gen is > type B is array(T) of Boolean; > pragma Pack(B); > type C is array (0 .. 100) of B; > > procedure Do_It is > O : C; > begin > O(1)(0) := False; ^ Here you assume that 0 is a value of the formal type T > end; > > end; > > end Gen; There is no guarantee that zero is a value of the actual type used for the formal type T; a (sub)type with a 'First of one is very likely. While the warning you got is not very good, some sort of warning seems in order here. -- Jeff Carter "I've got to stay here, but there's no reason why you folks shouldn't go out into the lobby until this thing blows over." Horse Feathers