Benjamin Pedersen
43 posts
Mathematician
[Bug] CLI stops at zero length array
Edited by Benjamin Pedersen on Reason: Initial post
When I run the command line interface and an array of length zero is encountered, it stops outputting, but no error is reported like in case if a scalar is given size 0. I haven't tried the GUI.

-layout
 1 2 3 4 5 6 7 8 9 struct Thing { string(1) a; string(1) b; string(1) c[a - 48]; // Just writing c[0] also produces the error. string(1) d; }; layout Thing; 

-data
 1 012 

I think it will be annoying to have to wrap every variable length array in an if-statement, so I think zero length arrays should be allowed.
Simon Anciaux
1191 posts
[Bug] CLI stops at zero length array
Maybe you'll get a faster answer if you report the issue on github.

If it's a important issue to you, the source code for the command line version is available. You could compile and debug it, maybe it's an easy issue to work around until a proper fix is available.
Benjamin Pedersen
43 posts
Mathematician
[Bug] CLI stops at zero length array
Makes sense to report it on GitHub, thanks.

Well, it is easy to get around the problem with an if-statement, just a bit annoying.

Jens
51 posts / 1 project
[Bug] CLI stops at zero length array
I just noticed this post (I haven't found out how to put on email notifications for HMN, if it's possible).

The zero length array (and member size) is something I've been thinking of supporting and as you've mentioned it here I probably put it in. Especially for types like
 1 2 3 4 5 struct LengthString { u(4) length; string(length) data; }; 

it just gets annoying to if-guard it.

I was thinking of maybe having a switch to add a warning about when a member is excluded due to size or array length being zero, then you can switch that on to see if that's the cause of missing members in the output.

I saw you made a ticket on GitHub for the lacking error message, I'll have a look at fixing it before the next release. Thank you for reporting it