Table of Contents

Class PredefinedConditionalConstants

Namespace
RDCore.SDK.Runtime
Assembly
RDCore.SDK.dll

The conditional-compilation constants every project starts with, which the environment defines (MS-VBAL §3.4.1): what each of them is in an environment.

public static class PredefinedConditionalConstants
Inheritance
PredefinedConditionalConstants
Inherited Members

Remarks

One table for every reader: the environment host defines these in each session it composes, and what the language server makes of a #If (which branch is live, what is analyzed) is what that session's constants say, so nothing reads them anywhere else.

Each is 1 where it is true and 0 where it is not, as MS-VBA defines its own (recorded in Excel), and not -1 as a Boolean stores True. A condition that tests one by itself means what it says, and so does a comparison with 0 or 1; one that reads its bits does not: #If Not Win64 is live on 64-bit Windows, because Not 1 is -2, and Win64 = True is False there (MS-VBAL §5.6.9.8). The analyzers report such a condition.

A project #Const, a command-line define and a module's own #Const override any of them.

Fields

False

The value of a predefined constant that is false.

public const short False = 0

Field Value

short

True

The value of a predefined constant that is true: 1, as MS-VBA defines Win32, Win64, VBA6 and VBA7.

public const short True = 1

Field Value

short

Properties

Names

The names of the constants the environment defines, whatever the environment: each is defined, true or false, in every one.

public static IReadOnlySet<string> Names { get; }

Property Value

IReadOnlySet<string>

Remarks

Names are compared without regard to case, as a #If reads them.

Methods

CanBeTrue(string)

Whether the predefined constant name is true in some environment: every one but Win16, which is never true.

public static bool CanBeTrue(string name)

Parameters

name string

The name of a constant of Names.

Returns

bool

false for Win16, and for a name that is not one of Names.

Of(IRuntimeEnvironmentProfile)

The name and the value of each constant the environment defines, in the order they are defined.

public static IReadOnlyList<(string Name, short Value)> Of(IRuntimeEnvironmentProfile environment)

Parameters

environment IRuntimeEnvironmentProfile

The environment: its operating system, its bitness and its build configuration decide the values.

Returns

IReadOnlyList<(string Name, short Value)>
ConstantIs 1
DEBUGIn a debug build (Configuration). RD-VBA's own.
Win16Never.
Win32On Windows, 32-bit or 64-bit: the Win32 API is there.
Win64On 64-bit Windows.
MacOn macOS.
LinuxOn Linux, 32-bit or 64-bit. RD-VBA's own.
Linux64On 64-bit Linux. RD-VBA's own.
VBA6Always, as in MS-VBA 7.
VBA7Always.