CKTIS / C++
false — the Boolean false literal
The keyword false is a literal of type bool representing logical falsity. It can initialize flags and control conditions. Promotion to int produces 0, but false itself is not an integer literal.
Version: C++23; repository compiler flag, production runtime not attested
Syntax
falsefalse is a keyword and one of C++'s two Boolean literals; the other is true. It has type bool and represents logical falsity. Write it without quotation marks: bool enabled = false; initializes a flag with a Boolean value, not text.
When an if condition yields false, its first branch is not executed; the else branch executes if present. In the example, enabled is false, so the program prints disabled.
Distinguish value from type: false has type bool, whereas 0 is an integer literal of type int. Promoting false to int produces 0, as the initialization of numeric demonstrates. In the opposite direction, converting a zero arithmetic value to bool produces false, while a nonzero value produces true.
You can check the example locally in C++23 mode. The displayed source was run unchanged in an isolated environment, and its standard output matched the expected output exactly. This check does not attest to behavior in a production runtime. The cited site hosts an evolving working draft, not the frozen text of the C++23 publication.
Examples
#include <iostream>
int main() {
bool enabled = false;
int numeric = false;
if (enabled) {
std::cout << "enabled\n";
} else {
std::cout << "disabled\n";
}
std::cout << numeric << '\n';
}
Result
disabled 0
The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.