From: "Nasser M. Abbasi" <nma@12000.org>
Subject: can one create an array of a size determined by a constant value of a function?
Date: Sat, 04 Feb 2012 05:00:11 -0600
Date: 2012-02-04T05:00:11-06:00 [thread overview]
Message-ID: <jgj33s$290$1@speranza.aioe.org> (raw)
Quick question for the experts:
I was looking at c++11 standard, where it show how
one can allocate an array of some size. The size is
determined by a function call. This is done at compile
time though where the compiler can determine the result
of the function, like this:
http://en.wikipedia.org/wiki/C%2B%2B11#cite_note-2
"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.
"
constexpr is new and was added in c++11
Is it possible to do something like this in Ada?
I am not sure now how useful or common such a feature would
be actually, but was just wondering how it will look
in Ada.
thanks,
--Nasser
next reply other threads:[~2012-02-04 11:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-04 11:00 Nasser M. Abbasi [this message]
2012-02-04 12:03 ` can one create an array of a size determined by a constant value of a function? Yannick Duchêne (Hibou57)
2012-02-04 18:36 ` Robert A Duff
2012-02-04 18:47 ` Jeffrey Carter
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