-
-
Save bcantrill/8aca3200f31a843b589f to your computer and use it in GitHub Desktop.
The surprising semantics of integral promotion
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 <stdio.h> | |
int | |
main() | |
{ | |
unsigned char a = 1, b = 2, c = 0; | |
if (a - b >= c) | |
printf("Expression true without explicit cast.\n"); | |
if ((unsigned char)(a - b) >= c) | |
printf("Expression true with explicit cast.\n"); | |
return (0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment