Table of Contents

RDC00201 — Integer data type declaration

Severity: Information  ·  Family: RDC (Rubberduck Core analyzers)  ·  Raised by: IntegerDataTypeAnalyzer

A declaration has an As Integer clause.

An Integer is a 16-bit signed type that overflows at 32,767, where a Long holds more than two billion (MS-VBAL §2.1 Data Values and Value Types; RD-VBAL §2.4.1 Intrinsic Types). The diagnostic is an opinion of the analyzer and not a condition of the language: both are legal VBA.

A Declare statement is not looked into: the types it states are the ones the external procedure takes, and are not the declaring module's to choose. A user-defined type that is read from or written to a file in a format that has 16-bit fields is a reason to keep an Integer; so is a procedure that must be called through a signature that states it.

That a declaration states the type is a fact of the way it is written: the analyzer reads it off the syntax tree, and reports the As clause.

How it is raised

Situation Example Resolution
A variable, a parameter, a return type or a field of a user-defined type is declared As Integer (or As VBA.Integer). Dim count As Integer Declare it As Long, unless a 16-bit value is what is needed.

See also


ACCUEIL • HOME | ℹ️ BIENVENUE • WELCOME | 🧩 BÂTISSONS • BUILD | RD-VBAL | SDK | 🌐 rubberduckvba.ca