In Ada how do I initialise an array constant with a repeated number?

Posted by mat_geek on Stack Overflow See other posts from Stack Overflow or by mat_geek
Published on 2010-03-30T00:21:19Z Indexed on 2010/03/30 0:23 UTC
Read the original article Hit count: 618

Filed under:
|
|

I need an array of 820 zeors for using with a mathematical function.

In C I could just write the following and the compiler would fill the array:

 const float EMPTY_NUMBER_A[820] = { 0.0, };

However in Ada that isn't possible. I really don't want to hard code the 820 elements as 0.0. Is there a way to get the compiler to do it?

 type Number_A is array (1 .. 820) of Float;
 EMPTY_NUMBER_A : constant Number_A := something;

Using Ada 95 and GNAT.

© Stack Overflow or respective owner

Related posts about ada

Related posts about arrays