** Attachment added: "Demo file" http://launchpadlibrarian.net/48940570/bugdemo.ods
** Description changed: Binary package hint: openoffice.org - ReDim (and Dim) throw a run-time error if UpperBound = (LowerBound-1). + ReDim (and Dim) throw a run-time error if UpperBound = (LowerBound-1). For example - Dim foo(0 to 9) - ... - ReDim foo(0 to -1) 'causes error + Dim foo(0 to 9) + ... + ReDim foo(0 to -1) 'causes error - This should not be an error, but should make the array contain zero elements. - Note that arrays can be initially declared as empty with - Dim foo() - which sets UBound to -1 + This should not be an error, but should make the array contain zero elements. + Note that arrays can be declared as empty with + Dim foo() + which has the save effect as ReDim foo(0 to -1) [except that it works...]. - It -is- possible to say - ReDim foo() - to set UBound to -1, but that form does not allow easy use in algorithms which compute array bounds at run-time and may validly want to get an empty array. + However that form does not allow easy use in algorithms which compute + array bounds at run-time and may validly want to result an empty array. + + DEMO: See attached file. For example - sub RemoveLastElements(ary(), n) - ReDim Preserve ary(LBound(ary) to UBound(ary)-n) - end sub + sub RemoveLastElements(ary(), n) + ReDim Preserve ary(LBound(ary) to UBound(ary)-n) + end sub ... should work for for n up to and including the total number of elements, but instead you currently have to code it like this: - sub RemoveLastElements(ary(), n) - if UBound(ary)-LBound(ary) > n then - ReDim Preserve ary(LBound(ary) to UBound(ary)-n) - else - ReDim ary() - end if + sub RemoveLastElements(ary(), n) + if UBound(ary)-LBound(ary) > n then + ReDim Preserve ary(LBound(ary) to UBound(ary)-n) + else + ReDim ary() + end if end sub ProblemType: Bug Architecture: amd64 Date: Wed Nov 4 14:25:11 2009 DistroRelease: Ubuntu 9.10 ExecutablePath: /usr/lib/openoffice/program/soffice.bin Package: openoffice.org-core 1:3.1.1-5ubuntu1 [modified: var/lib/openoffice/basis3.1/program/services.rdb] ProcEnviron: - PATH=(custom, user) - LANG=en_US.UTF-8 - SHELL=/bin/bash + PATH=(custom, user) + LANG=en_US.UTF-8 + SHELL=/bin/bash ProcVersionSignature: Ubuntu 2.6.31-14.48-generic SourcePackage: openoffice.org Uname: Linux 2.6.31-14-generic x86_64 -- ReDim to empty does not work https://bugs.launchpad.net/bugs/474844 You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. -- ubuntu-bugs mailing list [email protected] https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
