Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#18 variable length arrays

open
nobody
5
2006-03-25
2006-03-25
Erick Tryzelaar
No

According to skallar, something like this could be implemented
potentially in pure felix:

The variable length array thing is different, there
we have a constructor equivalent to this:

union varray[t]
| Array0
| Array1 of t
| Array2 of t2
| Array3 of t3
....

IF we had such an animal (which we don't) THEN you could
discover the dynamic length with caseno.

The implementation is just an ordinary variant,
which is a _uctor_. That's just basically

struct _uctor_ { int variant; void *data; };

where 'caseno' just returns the variant. This is different
to a fixed length array because the storage is on the heap.

-e

Discussion