comp.lang.ada
 help / color / mirror / Atom feed
* can one create an array of a size determined by a constant value of a function?
@ 2012-02-04 11:00 Nasser M. Abbasi
  2012-02-04 12:03 ` Yannick Duchêne (Hibou57)
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Nasser M. Abbasi @ 2012-02-04 11:00 UTC (permalink / 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



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-02-05 11:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2012-02-05 11:12 ` Pascal Obry

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