-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
27 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,42 @@ | ||
FIXME: add a description | ||
|
||
// If you want to factorize the description uncomment the following line and create the file. | ||
//include::../description.adoc[] | ||
|
||
== Why is this an issue? | ||
|
||
FIXME: remove the unused optional headers (that are commented out) | ||
There are several compilations options available for Visual Basic source code and ``++Option Explicit++`` defines compiler behavior for implicit variable declarations. Not specifying ``++Option Explicit++`` will allow creating a variable by it's first usage. This behavior can lead to unexpected runtime errors due to typos in variable names. | ||
|
||
//=== What is the potential impact? | ||
|
||
== How to fix it | ||
//== How to fix it in FRAMEWORK NAME | ||
``++Option Explicit++`` has to be set in individual source files. | ||
|
||
=== Code examples | ||
|
||
==== Noncompliant code example | ||
=== Noncompliant code example | ||
|
||
[source,vb6,diff-id=1,diff-type=noncompliant] | ||
---- | ||
FIXME | ||
Sub DoSomething(First As String, Second As String) | ||
Parameter = Fist ' New local variable "Fist" is created and assigned to new local variable "Parameter" instead of "First" argument. | ||
DoSomething(Parameter) | ||
Parametr = Second ' "Second" argument is assigned to newly created variable "Parametr" instead of intended "Parameter". | ||
DoSomething(Parameter) ' Value of "Parameter" is always Nothing | ||
End Sub | ||
Sub DoSomething(Parameter As String) | ||
' ... | ||
End Sub | ||
---- | ||
|
||
==== Compliant solution | ||
|
||
=== Compliant solution | ||
|
||
[source,vb6,diff-id=1,diff-type=compliant] | ||
---- | ||
FIXME | ||
Option Explicit | ||
Sub DoSomething(First As String, Second As String) | ||
Dim Parameter As String = First | ||
DoSomething(Parameter) | ||
Parameter = Second | ||
DoSomething(Parameter) | ||
End Sub | ||
Sub DoSomething(Parameter As String) | ||
' ... | ||
End Sub | ||
---- | ||
|
||
//=== How does this work? | ||
|
||
//=== Pitfalls | ||
|
||
//=== Going the extra mile | ||
|
||
|
||
//== Resources | ||
//=== Documentation | ||
//=== Articles & blog posts | ||
//=== Conference presentations | ||
//=== Standards | ||
//=== External coding guidelines | ||
//=== Benchmarks |