It is possible to use the increment operator ++
, to set the value of a bool
(C++) or _Bool
(C) variable to
true
. But this feature has been deprecated in C++ since the 1998 version of the standard, removed in C++17, and even where allowed, is
simply confusing.
Noncompliant code example
bool alive;
...
alive++;
Compliant solution
bool alive;
...
alive = true;