Table of Contents

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. It is reported with the default Explicit value of the Diagnostics.ByRefModifier setting; with Implicit, a parameter is written with neither, and ByRef is RDC00314 instead.

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). Nor are the parameters of a procedure that implements an interface member or handles an event, such as UserForm_QueryClose(Cancel As Integer, CloseMode As Integer): its signature is the member's or the event's.

That a parameter states no mechanism is a fact of the way it is written: the analyzer reads it off the syntax tree, and reads which procedure implements a member or handles an event from the host's model of the module. 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