Issue 120069 - [StarBasic] Typed parameters are copied instead of referenced
Summary: [StarBasic] Typed parameters are copied instead of referenced
Status: UNCONFIRMED
Alias: None
Product: App Dev
Classification: Unclassified
Component: api (show other issues)
Version: 3.3.0 or older (OOo)
Hardware: All All
: P3 Major
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-06-23 23:40 UTC by Andreas Säger
Modified: 2013-02-24 21:10 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Andreas Säger 2012-06-23 23:40:55 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.
Comment 1 Oliver Brinzing 2012-06-24 07:57:15 UTC
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
Comment 2 bmarcelly 2012-06-29 14:20:33 UTC
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.