I've looked around on the forum for answers to the question why you can't use a dynamic array as a member of a type but found very little. Perhaps I should have searched a little better but apart from lots of posts describing 'workarounds' (basically hacks to make up for the lack of support for dynamic arrays in type declarations) I found nothing.
I did find a feature request on sourceforge requesting dynamic arrays as part of a type declaration
http://sourceforge.net/tracker/?func=de ... tid=693199
The request was dated 2008.
As "dynamic arrays as part of a type declaration" is high on the wishlist of fb programmars you'd think it's high on the TODO list of the fb devs. But it's not even on the 'official' TODO list. I don't think it has ever been on the TODO list. That could mean a couple of things.
The most likely reason would be that the toolchain used (mingw/gcc) does 'something' that makes it impossible to have dynamic arrays as part of a type declaration. I don't know what that 'something' is but it could be a low - level, unsolvable binary problem.
A less likely reason would be that changing the implementation of dynamic arrays takes too much time. Perhaps it involves changing a substantial part of the source code. Who knows?
But I think that's exactly the problem: who knows? I don't and I have been on this forum since 2007. And the answers given to programmers new to fb asking about the lack of support for dynamic arrays usually amount to: 'can't do that, it's not possible'. Yet no real explanation is given (why is it not possible? why has it not been implemented?).
The manual tells you this about dynamic arrays:
So... who can explain (in plain English) why using dynamic arrays as part of a type declaration will result in undefined run-time behaviour? And what, if anything, can be done so we can use dynamic arrays as part of type declarations (or union declarations).ReDim cannot be used on fixed-size arrays - i.e. arrays with constant bounds made with Dim. This includes arrays contained in UDTs (user-defined Types), because currently only fixed-size arrays are supported in UDTs. This also includes fixed-length arrays passed as parameters in a function. FreeBASIC cannot prevent you trying this at compile-time, but the results at run-time will be undefined