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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,e55912fa8f040ab5 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!news3.google.com!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!cleanfeed2-a.proxad.net!nnrp15-1.free.fr!not-for-mail Date: Sat, 10 Oct 2009 08:39:47 +0200 From: Damien Carbonne User-Agent: Thunderbird 2.0.0.23 (X11/20090812) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: GNAT GPL 2009 - issue with floating points? References: <4acf9ee2$0$23472$426a34cc@news.free.fr> <6d8f169d-5dc8-465c-9368-be91efc2de0f@v15g2000prn.googlegroups.com> <4acfb607$0$412$426a34cc@news.free.fr> <7d4eb248-3730-4bf0-af51-72a062778510@u16g2000pru.googlegroups.com> In-Reply-To: <7d4eb248-3730-4bf0-af51-72a062778510@u16g2000pru.googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Message-ID: <4ad02c34$0$9952$426a74cc@news.free.fr> Organization: Guest of ProXad - France NNTP-Posting-Date: 10 Oct 2009 08:39:48 MEST NNTP-Posting-Host: 82.247.219.63 X-Trace: 1255156788 news-2.free.fr 9952 82.247.219.63:36604 X-Complaints-To: abuse@proxad.net Xref: g2news2.google.com comp.lang.ada:8648 Date: 2009-10-10T08:39:48+02:00 List-Id: Adam Beneschan a �crit : > On Oct 9, 3:15 pm, Damien Carbonne wrote: >> Adam Beneschan a �crit : >>>> -- pack04.ads:4:24: non-static expression used in number declaration >>>> -- pack04.ads:4:28: size attribute is only static for scalar type (RM >>>> 4.9(7,8)) >>>> RM 3.5(1): "scalar types comprise enumeration types, integer types, and >>>> real types." >>>> RM 3.5.6 (1): "Real types provide approximations to the real numbers, >>>> with relative bounds on errors for floating point types, and with >>>> absolute bounds for fixed point types." >>> Did you read the RM reference that the GNAT error message pointed you >>> to??? >> Yes I did ! > > The RM reference says (in paragraph 6) that the attribute reference > has to have a prefix that denotes a "static scalar subtype" (which is > defined later on in 4.9). The GNAT message says just "scalar > subtype"; as Ludovic points out, that could have been worded better > and should probably have said "static scalar subtype". However, one > should always trust the RM in preference to an error message, since > the RM is a standard. > > Also, keep in mind that a "static" expression is basically one that > the compiler can determine at compile time when it sees the > expression, and in this case it can't, because it has no idea what > sort of float will be used to instantiate the package. > > -- Adam > Thanks, now things are clearer. I understand that the compiler can not determine Real'Size when it compiles the generic package, but when it is instantiated, it should have then necessary knowledge. This should be true in simple cases (e.g., by instantiating the package with Float). Perhaps that things are not always so simple. Thanks again, Damien