You are not logged in. You can browse in the PowerBASIC Community, but you must click Login (top right) before you can post. If this is your first visit, check out the FAQ or Sign Up.
Arrays in TYPEs have certain limitations -- you can't use ARRAY SORT, for example -- and this is apparently another one. My guess is that since arrays in TYPEs must have hard-coded dimensions (since you can never use variables in a TYPE definition) that the developers assumed that nobody would ever want to use UBOUND. It would be very inefficient.
If you want your code to automatically "track" the size of the array as you change it during development, I'd recommend using equates. For example...
Code:
%Dim1UBOUND = 20
%Dim2UBOUND = 60
TYPE MyType2
Hello2 As Long
MT( 0 To %Dim1UBOUND, 0 To %Dim2UBOUND) As MyType1
END TYPE
...and then you could use %Dim1UBOUND or %Dim2UBOUND instead of UBOUND in the rest of your code. It would be much, much more efficient than using UBOUND, even if UBOUND worked.
However, since thes kind of arrays are steady, why not SORT etc..?
And Ubound was just a common practice for me, Now i need to know(type) this variable and it could differ per app (#app..)
Actually I think that PowerBasic should rename 'Arrays' in UDT's as 'Tables' in the documentation.
This would save a lot of confusion, as I tried using array-specific statements on UDT 'Arrays' and I couldn't figure out the problem until I asked on this forum.
We process personal data about users of our site, through the use of cookies and other technologies, to deliver our services, and to analyze site activity. For additional details, refer to our Privacy Policy.
By clicking "I AGREE" below, you agree to our Privacy Policy and our personal data processing and cookie practices as described therein. You also acknowledge that this forum may be hosted outside your country and you consent to the collection, storage, and processing of your data in the country where this forum is hosted.
Comment