Created
July 20, 2023 20:51
-
-
Save imaami/dc4f981dde40793e45f4c313d1966714 to your computer and use it in GitHub Desktop.
A value that is both bool(true) and EXIT_SUCCESS.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdio> | |
int main() { | |
constexpr auto tautology{1ull << 63}; | |
if (tautology) | |
std::puts("raw value evaluates to true"); | |
if (static_cast<bool>(tautology)) | |
std::puts("bool conversion equals true"); | |
// process exits with EXIT_SUCCESS | |
return static_cast<int>(tautology); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment