RDC00104 — Implicit ByRef modifier
Severity: Information · Family: RDC (Rubberduck Core analyzers) ·
Raised by: ImplicitByRefModifierAnalyzer
A parameter states neither ByRef nor ByVal.
A parameter that states no mechanism is passed by reference (MS-VBAL §5.3.1.5 Parameter Lists): the procedure can change the variable of the caller, which is rarely what a reader of the signature expects, and is not visible in it. The diagnostic is an opinion of the analyzer and not a condition of the language: both are legal VBA.
Two parameters are not reported, because they cannot state it: a ParamArray, and the value parameter of a property Let or Set, which is always passed by value
(MS-VBAL §5.3.1.7 Property Declarations).
That a parameter states no mechanism is a fact of the way it is written: the analyzer reads it off the syntax tree. It is a suggestion because writing the keyword does not change what the procedure does.
How it is raised
| Situation | Example | Resolution |
|---|---|---|
A parameter of a procedure, an event or a Declare states no ByRef or ByVal. |
Sub Work(total As Long) |
Write ByRef if the procedure is meant to change the argument, and ByVal otherwise. |
See also
ACCUEIL • HOME | ℹ️ BIENVENUE • WELCOME | 🧩 BÂTISSONS • BUILD | RD-VBAL | SDK | 🌐 rubberduckvba.ca