Created
June 11, 2014 23:12
-
-
Save monaka/ebb9b6dca4402078d58e to your computer and use it in GitHub Desktop.
Difference between _Bool and integers.
This file contains hidden or 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> | |
#include <stdint.h> | |
void | |
hoge(uint8_t b) | |
{ | |
/* b == 0 */ | |
if (b) printf("hoge"); | |
} | |
void | |
fuga(_Bool b) | |
{ | |
/* b == 1 */ | |
if (b) printf("fuga"); | |
} | |
int | |
main(void) | |
{ | |
const int a = 234882310; | |
hoge(a & 256); | |
fuga(a & 256); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment