You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To be able to have String or any other kind of unconstrained array in a record I often use the following pattern:
type Data (Str_Len : Natural) isrecord
Str : String (1 .. Str_Len);
endrecord;
This is convenient and works for me most of the time. However one annoying aspect is that when writing an aggregate one has to update the discriminant when changing the string.
It's ok for short strings:
return (4, "test");
return (4, "But it is annoying for long string");
So I have two suggestions to discuss here:
I think the compiler error could be improved to give the expected value for the discriminant instead of just saying "wrong length for array".
Would it be possible to allow box notation here?
return (<>, "This is a lot better");
The text was updated successfully, but these errors were encountered:
To be able to have String or any other kind of unconstrained array in a record I often use the following pattern:
This is convenient and works for me most of the time. However one annoying aspect is that when writing an aggregate one has to update the discriminant when changing the string.
It's ok for short strings:
So I have two suggestions to discuss here:
The text was updated successfully, but these errors were encountered: