From: Jeffrey Carter <spam.jrcarter.not@spam.not.acm.org>
Subject: Re: can one create an array of a size determined by a constant value of a function?
Date: Sat, 04 Feb 2012 11:47:29 -0700
Date: 2012-02-04T11:47:29-07:00 [thread overview]
Message-ID: <jgjugl$mmr$1@adenine.netfront.net> (raw)
In-Reply-To: <jgj33s$290$1@speranza.aioe.org>
On 02/04/2012 04:00 AM, Nasser M. Abbasi wrote:
> "constexpr int get_five() {return 5;}
> int some_value[get_five() + 7]; // Create an array of 12 integers. Legal C++11
> This allows the compiler to understand, and verify, that get_five is
> a compile-time constant.
> "
With Ada, you can declare an array with a size not known at compile time:
function Get return Positive is
-- null;
begin -- Get
return Integer (Ada.Calendar.Seconds (Ada.Calendar.Clock) );
end Get;
S : String (1 .. Get);
--
Jeff Carter
"Nobody expects the Spanish Inquisition!"
Monty Python's Flying Circus
22
--- Posted via news://freenews.netfront.net/ - Complaints to news@netfront.net ---
next prev parent reply other threads:[~2012-02-04 18:47 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-04 11:00 can one create an array of a size determined by a constant value of a function? Nasser M. Abbasi
2012-02-04 12:03 ` Yannick Duchêne (Hibou57)
2012-02-04 18:36 ` Robert A Duff
2012-02-04 18:47 ` Jeffrey Carter [this message]
2012-02-05 11:12 ` Pascal Obry
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox