Skip to content

Conversation

@Rainyan
Copy link
Collaborator

@Rainyan Rainyan commented Jan 28, 2026

Description

Require the bMin and bMax values of ConVar constructors be evaluated from boolean types, to prevent bugs with typo'd argument order where an incorrect argument would silently get evaluated as the boolean value, and/or be swapped with the intended float min/max bound, without raising a compiler error.

For example, for the ConVar ctor arguments:

bool bMin, float fMin, bool bMax, float fMax

one could accidentally write:

100, true, 2000, true

which would implictly get converted to:

bMin=bool(100)=true, fMin=float(true)=1, bMax=bool(2000)=true, fMax=float(true)=1

instead of the intended:

bMin=true, fMin=100, bMax=true, fMax=2000.

By introducing specialized deleted constructors for non-boolean inputs to the bMin/bMax and bCompMin/bCompMax args, we can cause the compiler to error in such cases to catch these bugs.

In the rare case where the programmer really meant to evaluate a non-boolean type for these args, they can still explicitly cast it to bool to express that intent, and make it work.

Toolchain

  • Windows MSVC VS2022

Linked Issues

Require the bMin and bMax values of ConVar constructors to be evaluated
from boolean values, to prevent bugs with typo'd argument order where an
incorrect argument would silently get evaluated as the boolean value
without raising a compiler error.
@Rainyan Rainyan requested a review from a team January 28, 2026 10:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant