Skip to content

Instantly share code, notes, and snippets.

@imaami
Created July 20, 2023 20:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save imaami/dc4f981dde40793e45f4c313d1966714 to your computer and use it in GitHub Desktop.
Save imaami/dc4f981dde40793e45f4c313d1966714 to your computer and use it in GitHub Desktop.
A value that is both bool(true) and EXIT_SUCCESS.
#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