comp.lang.ada
 help / color / mirror / Atom feed
From: Damien Carbonne <damien.carbonne@free.fr>
Subject: Re: GNAT GPL 2009 - issue with floating points?
Date: Sat, 10 Oct 2009 08:39:47 +0200
Date: 2009-10-10T08:39:48+02:00	[thread overview]
Message-ID: <4ad02c34$0$9952$426a74cc@news.free.fr> (raw)
In-Reply-To: <7d4eb248-3730-4bf0-af51-72a062778510@u16g2000pru.googlegroups.com>

Adam Beneschan a �crit :
> On Oct 9, 3:15 pm, Damien Carbonne <damien.carbo...@free.fr> 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



  reply	other threads:[~2009-10-10  6:39 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-09 20:36 GNAT GPL 2009 - issue with floating points? Damien Carbonne
2009-10-09 21:06 ` Adam Beneschan
2009-10-09 22:15   ` Damien Carbonne
2009-10-09 22:44     ` Ludovic Brenta
2009-10-10  6:33       ` Damien Carbonne
2009-10-10 14:55       ` Samuel Tardieu
2009-10-10 16:12         ` Ludovic Brenta
2009-10-10 16:38         ` Damien Carbonne
2009-10-09 23:26     ` Adam Beneschan
2009-10-10  6:39       ` Damien Carbonne [this message]
2009-10-10  7:16         ` Dmitry A. Kazakov
2009-10-11  9:33           ` Dirk Herrmann
2009-10-11 10:27             ` Dmitry A. Kazakov
2009-10-12 23:26               ` Randy Brukardt
replies disabled

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