Issue 12272

Summary: pass constant by reference in macro does not produce an error
Product: App Dev Reporter: andrew
Component: scriptingAssignee: ab
Status: CLOSED FIXED QA Contact: issues@framework <issues>
Severity: Trivial    
Priority: P3 CC: issues
Version: 3.3.0 or older (OOo)   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Issue Type: DEFECT Latest Confirmation in: ---
Developer Difficulty: ---

Description andrew 2003-03-12 15:37:20 UTC
I pass a constant by reference and then I modify it in the called procedure. 
This should produce a compiler error!

ption Explicit
Sub LoopForever
	Dim l As Long
	l = 4
	LoopWorker(l)
	Print "Passed l by value and it is still " + l
	LoopForeverWorker(l)
	' l is now 1 so this will print 1.
	Print "Passed l by reference and it now is " + l
	' This will loop forever because 4 is a constant
	' and you can NOT change it. 
	Print "Passing a constant parameter by reference, this will be fun"
	Print LoopForeverWorker(4)
End Sub

Sub LoopWorker(ByVal n As Long)
	Do While n > 1
		Print n
		n = n - 1
	Loop
End Sub

Sub LoopForeverWorker(n As Long)
	Do While n > 1
		' This is fun when n is a constant.
		Print n
		n = n - 1
	Loop
End Sub
Comment 1 andrew 2003-03-12 22:26:39 UTC
Verified by Kelvin and responded to by ab@openoffice.org
Comment 2 Unknown 2003-03-19 08:14:44 UTC
Misfiled, the framewwork/ scripting deals with the langauge
independent scripting framework, not Star Basic:

This StarBasic issue should be filed under:
Component: Scripting
SubComponent: Code

Comment 3 ab 2003-03-19 11:07:15 UTC
Sorry, I mixed it up and told Andrew the wrong component.
Comment 4 ab 2003-03-19 11:11:29 UTC
I didn't want to change the version to 1.0.1 but the system forced
me to do so and does not offer 1.0.2 now at all. I don't know, why.
Comment 5 thorsten.ziehm 2003-04-23 13:22:18 UTC
Andreas told me, that is too risky to fix this bug in OOo1.1. It is
planed to fix it in OOo2.0. I change the target.
Comment 6 andrew 2003-04-24 03:11:25 UTC
Rather than generating an error, it may be possible to generate a 
temporary to use as the parameter.
Comment 7 christof.pintaske 2004-06-17 16:47:15 UTC
cp: retargeted to Office-Later due to limited ressources
Comment 8 ab 2005-07-28 14:21:56 UTC
This problem has been fixed in the scope of the internal task
#112281 in cws ab10fixes integrated into src680, m54.

Comment 9 ab 2005-07-28 14:23:20 UTC
CLOSED