<html>
<head>
<base href="https://bugs.documentfoundation.org/">
</head>
<body><span class="vcard"><a class="email" href="mailto:andreas.heinisch@yahoo.de" title="Andreas Heinisch <andreas.heinisch@yahoo.de>"> <span class="fn">Andreas Heinisch</span></a>
</span> changed
<a class="bz_bug_link
bz_status_ASSIGNED "
title="ASSIGNED - BASIC: Array function forces the lower boundary for arrays as 0 in spite of option base 1"
href="https://bugs.documentfoundation.org/show_bug.cgi?id=54912">bug 54912</a>
<br>
<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>What</th>
<th>Removed</th>
<th>Added</th>
</tr>
<tr>
<td style="text-align:right;">CC</td>
<td>
</td>
<td>mikekaganski@hotmail.com
</td>
</tr></table>
<p>
<div>
<b><a class="bz_bug_link
bz_status_ASSIGNED "
title="ASSIGNED - BASIC: Array function forces the lower boundary for arrays as 0 in spite of option base 1"
href="https://bugs.documentfoundation.org/show_bug.cgi?id=54912#c13">Comment # 13</a>
on <a class="bz_bug_link
bz_status_ASSIGNED "
title="ASSIGNED - BASIC: Array function forces the lower boundary for arrays as 0 in spite of option base 1"
href="https://bugs.documentfoundation.org/show_bug.cgi?id=54912">bug 54912</a>
from <span class="vcard"><a class="email" href="mailto:andreas.heinisch@yahoo.de" title="Andreas Heinisch <andreas.heinisch@yahoo.de>"> <span class="fn">Andreas Heinisch</span></a>
</span></b>
<pre>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
<a href="https://jezzper.com/jezzper/discussions.nsf/0/3C030B7CC3F24D5FC1256F65002BC1B5">https://jezzper.com/jezzper/discussions.nsf/0/3C030B7CC3F24D5FC1256F65002BC1B5</a>)
- 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.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>