comp.lang.ada
 help / color / mirror / Atom feed
From: "Frank J. Lhota" <NOSPAM.FrankLho@rcn.com>
Subject: Re: sizetest.ads:10:28 non-static expression used in number declaration
Date: Mon, 29 Mar 2004 08:11:00 -0500
Date: 2004-03-29T08:11:00-05:00	[thread overview]
Message-ID: <40682065$0$3043$61fed72c@news.rcn.com> (raw)
In-Reply-To: wvbrbrmfucmq.fsf@europa1.Norway.Sun.COM

A number declaration must use a static expression. The ARM gives a very
strict definition of when a subtype is considered static: it must be a
static scalar subtype, or a static string subtype (see 4.9, paragraph 26).
Foo, being a record type, is not static.

This criteria for static subtypes may seem to be overly strict. It is
difficult, however, to devise a more comprehensive definition of static
subtype without getting into a lot of complexities. As you have noted, the
problem can be avoided by defining Foo_Size to be a constant integer, rather
than a named number. The expression used to initialize a constant need not
be static.

A related issue: enumeration literals are static, but renamed enumeration
literals are not. Hence if I declare

    function Yes return Boolean renames True;

then True is static, but Yes is not. Frankly, I find this annoying.









  reply	other threads:[~2004-03-29 13:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-29 11:16 sizetest.ads:10:28 non-static expression used in number declaration Ole-Hjalmar Kristensen
2004-03-29 13:11 ` Frank J. Lhota [this message]
  -- strict thread matches above, loose matches on Subject: below --
2004-03-29 11:13 Ole-Hjalmar Kristensen
2004-03-29 16:31 ` Robert I. Eachus
replies disabled

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