forked from rubberduck-vba/Rubberduck
-
Notifications
You must be signed in to change notification settings - Fork 0
ImplicitByRefParameterInspection
Philip Wales edited this page Apr 10, 2015
·
1 revision
Description: Parameter is passed ByRef implicitly
Type: CodeInspectionType.CodeQualityIssues
Default severity: CodeInspectionSeverity.Warning
This inspection finds procedure parameters that are implicitly passed by reference.
###Example:
Parameter foo
is implicitly passed ByRef
in this method signature:
Public Sub DoSomething(foo As Integer)
End Sub
This code is potentially confusing, because it assumes the maintainer knows VBA passes parameter ByRef
by default. Other languages, including VB.NET, pass parameters by value by default.
###QuickFixes
QuickFix: Pass parameter by reference explicitly
Public Sub DoSomething(ByRef foo As Integer)
End Sub
By explicitly specifying a parameter is passed by reference, there is no possible ambiguity and the maintainer knows how the parameter is passed, regardless of their knowledge of VBA.