comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: TYPE'Size in static expression
Date: Mon, 24 Oct 2005 13:45:51 +0200
Date: 2005-10-24T13:45:52+02:00	[thread overview]
Message-ID: <103nkxb7oxxgt$.zi0lnvwylys0$.dlg@40tude.net> (raw)
In-Reply-To: 435CBDDF.3040607@dif.andthis.um.es

On Mon, 24 Oct 2005 12:56:31 +0200, Francisco J. Montoya wrote:

> That, indeed, solved my problem, but I still do not finish in 
> understanding why what I wrote did not work. The expression I wrote is 
> supposed to be of "Universal Integer Type", isn't it? So adding the 
> explicit type "Integer" to the constant definition should not make much 
> difference.

"Universal integer constant" have to be static. But just constant T need
not to be. This makes the difference. So you could also write:

type Buffer is array (1..8 * Buffer_Size / BaseType'Size) of BaseType;

Ada's rules about static expressions are a bit tricky. But for a generic
body, it is clear that BaseType'Size cannot be static.

[ Or, well, it could be, if generics were treated like C++ templates. But
then sharing of generic bodies would be difficult, if possible. ]

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



  reply	other threads:[~2005-10-24 11:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-21  8:04 TYPE'Size in static expression Francisco J. Montoya
2005-10-21  8:55 ` Dmitry A. Kazakov
2005-10-21 22:09   ` Jeffrey R. Carter
2005-10-24 10:56   ` Francisco J. Montoya
2005-10-24 11:45     ` Dmitry A. Kazakov [this message]
2005-10-24 19:15     ` Jeffrey R. Carter
2005-10-24 20:15       ` Robert A Duff
replies disabled

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