[Libreoffice-bugs] [Bug 54912] BASIC: Array function forces the lower boundary for arrays as 0 in spite of option base 1
bugzilla-daemon at bugs.documentfoundation.org
bugzilla-daemon at bugs.documentfoundation.org
Tue Aug 25 09:20:16 UTC 2020
https://bugs.documentfoundation.org/show_bug.cgi?id=54912
Andreas Heinisch <andreas.heinisch at yahoo.de> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mikekaganski at hotmail.com
--- Comment #13 from Andreas Heinisch <andreas.heinisch at yahoo.de> ---
After some investigation, here are my findings. Consider the following code
snippet:
Sub Main()
Dim strArray(2) As String
MsgBox LBound(strArray)
MsgBox UBound(strArray)
MsgBox UBound(strArray, 1) - LBound(strArray, 1) + 1
Redim strArray(3)
MsgBox LBound(strArray)
MsgBox UBound(strArray)
MsgBox UBound(strArray, 1) - LBound(strArray, 1) + 1
End Sub
Without any option:
- the array starts at 0 and ends at 2 with 3 elements.
- after the redim the array starts at 0 and ends at 3 with 4 elements.
With option base 1:
- the array starts at 1 and ends at 3 with 3 elements, since this option
increases also the upper bound (see #109275 in
https://jezzper.com/jezzper/discussions.nsf/0/3C030B7CC3F24D5FC1256F65002BC1B5)
- after the redim the array starts at 1 and ends at 4 with 4 elements.
With option base 1 and option compatible:
- the array starts at 1 and ends at 2 with 2 elements, since option
compatible does not change the upper bound
- after the redim the array starts at 1 and ends at 3 with 3 elements.
At the moment, the option base is not fully implemented and works only with the
additional VBASupport option.
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20200825/6c119148/attachment-0001.htm>
More information about the Libreoffice-bugs
mailing list