Bugzilla – Attachment 72968 Details for
Bug 59327
BASIC: A missing optional argument is treated as a not declared variable.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
A code example to reproduce the bug.
Error__Optional_argument_is_not_a_variable.bas (text/plain), 1.08 KB, created by
Vladimir
on 2013-01-13 19:09:06 UTC
(
hide
)
Description:
A code example to reproduce the bug.
Filename:
MIME Type:
Creator:
Vladimir
Created:
2013-01-13 19:09:06 UTC
Size:
1.08 KB
patch
obsolete
>' VB__Bugs > > >'Option Explicit > > >Private Sub Do__Error__Optional_argument_is_not_a_variable__Error(Optional ByVal anArgument) > > Dim aVariable as Single > > If False Then Dim anArgument as Boolean > > aVariable=anArgument ' This line produces an error 12, if "option explicit' is used. > aVariable=-456 ' This line is executed only if "option explicit' is NOT used. > >End Sub 'Do__Error__Optional_argument_is_not_a_variable__Error > > >Private Sub Do__Error__Optional_argument_is_not_a_variable__Success(Optional ByVal anArgument) > > Dim aVariable as Single > > 'If False Then Dim anArgument as Boolean > > aVariable=anArgument > aVariable=-456 > >End Sub 'Do__Error__Optional_argument_is_not_a_variable__Success > > >Sub Error__Optional_argument_is_not_a_variable > > Do__Error__Optional_argument_is_not_a_variable__Success anArgument:=-123 ' This call never produces an error. > MsgBox "1: +" > > Do__Error__Optional_argument_is_not_a_variable__Error anArgument:=-123 ' This call produces an error 12, if "option explicit' is used. > MsgBox "2: +" > >End Sub 'Error__Optional_argument_is_not_a_variable > > >Sub Main > >End Sub
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 59327
: 72968 |
113716