CKTIS / C++
Operator >= — greater than or equal to
The >= operator checks whether the left operand is greater than or equal to the right operand. Built-in comparisons return bool. Numeric comparisons require attention to type conversions, particularly when mixing signed and unsigned integers.
Version: C++23; repository compiler flag, production runtime not attested
Syntax
lhs >= rhslhs >= rhs means “greater than or equal to.” A built-in numeric comparison returns true when the relation holds and false otherwise; its result has type bool. Equality is enough to satisfy the condition: 70 >= 70 produces true.
Numeric operands undergo the usual arithmetic conversions before comparison. Mixing signed and unsigned types can change the expected result: in -1 >= 1u, the left operand is converted to unsigned int, and the result is true. Where possible, compare values of the same, appropriately chosen type.
Do not express a range as high >= value >= low: it groups as (high >= value) >= low. Write two conditions joined by &&: high >= value && value >= low. For pointers, do not assume a universal address ordering: elements of the same array have a defined order, but the result for unrelated objects can be unspecified.
User-defined types can provide operator>=; overload resolution can also use operator<=>. The bool result rule applies to the built-in operator, not every overload. The supplied example targets C++23; the source is an evolving working draft, not a frozen C++23 publication.
Examples
#include <iostream>
int main() {
constexpr int score = 70;
constexpr int minimum = 70;
static_assert(score >= minimum);
static_assert(!(69 >= minimum));
std::cout << std::boolalpha
<< (score >= minimum) << '\n'
<< (69 >= minimum) << '\n';
}
Result
true false
The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.