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: [email protected]
          Reporter: [email protected]

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.
_______________________________________________
Libreoffice-bugs mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs

Reply via email to