[Libreoffice-bugs] [Bug 134692] New: Formerly working BASIC function to get a copy of an array no longer working. Interoperability and compatibilty affected.

bugzilla-daemon at bugs.documentfoundation.org bugzilla-daemon at bugs.documentfoundation.org
Thu Jul 9 14:49:41 UTC 2020


https://bugs.documentfoundation.org/show_bug.cgi?id=134692

            Bug ID: 134692
           Summary: Formerly working BASIC function to get a copy of an
                    array no longer working. Interoperability and
                    compatibilty affected.
           Product: LibreOffice
           Version: 7.0.0.0.alpha0+
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: BASIC
          Assignee: libreoffice-bugs at lists.freedesktop.org
          Reporter: jag at psilosoph.de

Created attachment 162852
  --> https://bugs.documentfoundation.org/attachment.cgi?id=162852&action=edit
Allowing to run code as proof for the reported bug.

It's well known that arrays are assigned by reference generally, and that the
ByVal clause is disregarded for arrays passed to functions or subs. (Or, in
other words probably that the pointer is treated as the value.) 

However, up to Version 6.4.4.2 (at least):
If inside the body of a function having taken an array as parameter, it was
assigned to a new variable, say newVar, and this different variable was treated
by 

Redim Preseve newVar(without changing the dimensions), 

then newVar could be returned by the function to the caller, and this way
created a real copy of the original array passed as parameter.  

As I was told, this should also be the behavior of VBA. 

This doesn' work any longer. 

Leaving it the new way would also introduce logically inacceptable results as
demonstrated in the attachment, but mainly it would break existing code. 

In addition workarounds needing to assign array elements one by one to a copy
are inefficient by a factor of typically about 500 (judged from my testing).

Check my claims by running the code contained in the attachment stepwise as
explaied tom the detail in the attachment itself.

-- 
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/20200709/3df1531b/attachment.htm>


More information about the Libreoffice-bugs mailing list