Apache OpenOffice (AOO) Bugzilla – Issue 120069
[StarBasic] Typed parameters are copied instead of referenced
Last modified: 2013-02-24 21:10:02 UTC
Sub Test x=-1 in_out x print x REM should print 13, prints -1 End Sub Sub in_out(x as integer) x=13 End Sub This does not make any difference and should not since ByRef is the default: Sub in_out(ByRef x as integer) This makes a difference. Caller prints 13: Sub in_out(x) I'd consider this as a regression since it breaks old Basic macros.
with "Dim x as Integer" it the result is always 13 OPTION EXPLICIT Sub Test() Dim x as Integer x=-1 in_out(x) print x REM prints 13 in OO 3.2 / AOO 3.4 End Sub Sub in_out(x as integer) x=13 End Sub
It also works correctly if you are consistent in _not_ declaring types: Sub Test x=-1 in_out x print x REM prints 13 End Sub Sub in_out(x) x=13 End Sub IMHO the origin is same as described in Bug 64746 (classified as WONTFIX). It is not a regression of 3.3 or 3.4, but a much older regression.