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-Thread: a07f3367d7,e55912fa8f040ab5 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!postnews.google.com!v15g2000prn.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: GNAT GPL 2009 - issue with floating points? Date: Fri, 9 Oct 2009 14:06:43 -0700 (PDT) Organization: http://groups.google.com Message-ID: <6d8f169d-5dc8-465c-9368-be91efc2de0f@v15g2000prn.googlegroups.com> References: <4acf9ee2$0$23472$426a34cc@news.free.fr> NNTP-Posting-Host: 66.126.103.122 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1255122403 2227 127.0.0.1 (9 Oct 2009 21:06:43 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 9 Oct 2009 21:06:43 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: v15g2000prn.googlegroups.com; posting-host=66.126.103.122; posting-account=duW0ogkAAABjRdnxgLGXDfna0Gc6XqmQ User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; WOW64; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.21022; .NET CLR 3.5.30729; .NET CLR 3.0.30618),gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:8639 Date: 2009-10-09T14:06:43-07:00 List-Id: On Oct 9, 1:36=A0pm, Damien Carbonne wrote: > Hi, > > When compiling the following sample code with GNAT GPL 2009 on Linux: > > generic > =A0 =A0 type Real is digits <>; > package Pack04 is > =A0 =A0 Size1 : constant :=3D Real'Size; > =A0 =A0 Size2 : constant Integer :=3D Real'Size; > end Pack04; > > I get this: > > -- 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??? Also read 4.9(26). > So Real is supposed to be a scalar! > > Is this a problem with (misleading) message or with (effectively) wrong > code? The code is wrong. And anyway, the declaration of Size2 is legal (even though the declaration of Size1 isn't), so there's no problem. -- Adam