empty array litteral

J

Julien REINAULD

Guest
Hi all!

According to std.standard:

TYPE string IS ARRAY ( positive RANGE <> OF character);

"hello" is a valid string litteral
"" is a valid string litteral too, it is the empty string.


Let

TYPE foo IS ARRAY ( positive RANGE <> OF integer);

(0, 1, 1, 2, 3, 5) is a valid foo litteral

What is the litteral for an empty foo?

Thx

Julien
 
On Jul 13, 1:54 pm, Julien REINAULD <julien.reina...@gmail.com> wrote:
Hi all!

According to std.standard:

TYPE string IS ARRAY ( positive RANGE <> OF character);

"hello" is a valid string litteral
"" is a valid string litteral too, it is the empty string.

Let

TYPE foo IS ARRAY ( positive RANGE <> OF integer);

(0, 1, 1, 2, 3, 5) is a valid foo litteral

What is the litteral for an empty foo?

Thx

Julien
That is an interesting question.

You can make a null constant like this:

constant NULL_FOO : foo(1 downto 2) := (others => 0);

then use the constant in place of a literal.
 
On 13/07/11 14:25, Tricky wrote:
On Jul 13, 1:54 pm, Julien REINAULD <julien.reina...@gmail.com> wrote:
Hi all!

According to std.standard:

TYPE string IS ARRAY ( positive RANGE <> OF character);

"hello" is a valid string litteral
"" is a valid string litteral too, it is the empty string.

Let

TYPE foo IS ARRAY ( positive RANGE <> OF integer);

(0, 1, 1, 2, 3, 5) is a valid foo litteral

What is the litteral for an empty foo?

Thx

Julien

That is an interesting question.

You can make a null constant like this:

constant NULL_FOO : foo(1 downto 2) := (others => 0);

then use the constant in place of a literal.
I haven't tried it, or looked it up in the LRM, but I imagine you may be
able to use

(1 downto 2 => 0)

though of course a named constant is nicer.

regards
Alan

--
Alan Fitch
 

Welcome to EDABoard.com

Sponsor

Back
Top