Issue 23763 - Basic : missing Optional argument gets value = 448
Summary: Basic : missing Optional argument gets value = 448
Status: CONFIRMED
Alias: None
Product: udk
Classification: Code
Component: code (show other issues)
Version: OOo 1.1
Hardware: All Windows XP
: P4 Trivial (vote)
Target Milestone: AOO PleaseHelp
Assignee: AOO issues mailing list
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-12-21 16:08 UTC by bmarcelly
Modified: 2015-02-26 18:05 UTC (History)
2 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description bmarcelly 2003-12-21 16:08:25 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.
Comment 1 ooo 2004-01-06 14:05:04 UTC
StarBASIC runtime, not API
Comment 2 ab 2004-01-16 15:28:14 UTC
AB: It's useless to use an optional parameter without IsMissing(), 
so its value is irrevant -> Accepted but changed to P4.
Comment 3 ab 2004-01-16 16:34:45 UTC
-> OOo 2.0
Comment 4 Martin Hollmichel 2004-05-28 17:36:38 UTC
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.
Comment 5 Regina Henschel 2015-02-26 18:05:56 UTC
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.