OK, I searched the forums for this, but coulnd't find it, so apologies if it has been posted somewhere. I was "insprired" by a message to the mailing list where a guy was asking to have PB arrays improved to be more like arrays in C (hmm, or was that the Blitz mailing list?...)
Anyway, you can create a newtype with an array of size zero, allowing you to create pointers to non-specific sized arrays.
Example code:
Code: Select all
; ----8<----8<----8<----
Structure fakearray
word.w[0]
EndStructure
Dim array.w(10)
For i.w=0 To 9
array(i)=i*5
Next
*foo.fakearray = @array(0)
If OpenConsole()
For i=0 To 9
Print("Item ") : Print(Str(i)) : Print(", contents ") : PrintN(Str(*foo\word[i]))
Next
Input()
CloseConsole()
EndIf
End
; ----8<----8<----8<----
--
It's not minimalist - I'm increasing efficiency by reducing input effort.