Apache OpenOffice (AOO) Bugzilla – Issue 23763
Basic : missing Optional argument gets value = 448
Last modified: 2015-02-26 18:05:56 UTC
Problem when an Optional parameter is missing. Run this in a Basic module : Option Explicit Sub Main(Optional arg1 As Integer) Dim x As Integer for x = 445 to arg1 print x, arg1 next End Sub You will see "Error?" when printing arg1 . The for/next loop runs up to x=448 and then stops. The same behaviour appears if arg1 is a Boolean, a Variant, a String, etc ! The bug is that a missing Optional parameter should either have the same initial value as a newly defined variable, or any use of it should raise a runtime error. The current behaviour is not acceptable.
StarBASIC runtime, not API
AB: It's useless to use an optional parameter without IsMissing(), so its value is irrevant -> Accepted but changed to P4.
-> OOo 2.0
according to the announcement on releases (http://www.openoffice.org/servlets/ReadMsg?list=releases&msgNo=7503) this issue will be re-targeted to OOo Later.
The problem can also been seen, when the optional parameter is not the last one, but in-between. Then the variable gets a value, e.g. "error |" for strings and 448 for double. So ismissing() does not catch missing parameters. No work by ab@bregas.de, so set back to default owner and not assigned.