Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
undocumented Len function
#1
in the Wiki the Len function is described for strings only but QBasic uses the Len function also to get the size in bytes of data types including udts
but QB64pe also gives the size in bytes of an array, but this seems to be a feature and it behaves strangely
the following works and prints 50, 100 and 200
Code: (Select All)

Dim As Integer i(4, 4)
Dim As Long l(4, 4)
Dim As _Integer64 ll(4, 4)

Print Len(i())
Print Len(l())
Print Len(ll())
but if you add the following
Code: (Select All)

Print Len(l()) / Len(i())
it prints 100 instead of 2, the division never takes place
I think that getting the SizeOf an array would be nice to have and it almost works, perhaps the developers could fix it so that the last statement would be evaluated correctly
Reply
#2
Looks like a bug in the processing to me:

Code: (Select All)
Dim As Integer i(4, 4)
Print Len(i())
Print Len(i()) / 2
Reply
#3
Definitly a very old bug then, QB64 v0.954 (last SDL based version) behaves the same way.
Reply
#4
actually, I think that the Len of an array is an unintentional feature, it not supported by QBasic but it's so close to working in QB64pe that it would be a shame not to fix it
Reply




Users browsing this thread: 1 Guest(s)