Closed Bilgus closed 4 months ago
The shell backend does not support using structs directly, either as a function parameter or as a local variable. This is documented in the Known Issues section of the README.
Aggregate types (arrays and structures) cannot be stack-allocated, passed by value or nested in a structure.
In your example, the sum
function could take a pointer to a foo
structure and it should work.
/ Function computing the sum of an array / struct foo { int a; int b; }barf; int sum(int a, struct foo) { int i, sum = 0; for (i = 0; i < foo.a; i += 1) { b += a[i]; } return *b; }
:barf array of struct and struct value type are not supported in shell backend. Use a reference type instead.
maybe should mention that in your caveats too, whats a reference type?