- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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 JulienLink Copied
5 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Did you try () or (null)?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The only way I know is to create a null array constant, and use that in place of a literal:
constant NULL_FOO : foo(1 downto 2) := (others => 0);- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yes.
neither of these work :(- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
OK for 1 downto 2 range.
Any other (cleaner) way?- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I dont think there is. Could you explain why you want to do it?
another less "clean" way - declare a pointer to foo. type foo_ptr_t is access foo; variable foo_ptr : foo_ptr_t; and then you can actually compare it to null: if foo_ptr = null then ...etc But that is getting rather extreme.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page