Skip to content

Instantly share code, notes, and snippets.

@monaka
Created June 11, 2014 23:12
Show Gist options
  • Save monaka/ebb9b6dca4402078d58e to your computer and use it in GitHub Desktop.
Save monaka/ebb9b6dca4402078d58e to your computer and use it in GitHub Desktop.
Difference between _Bool and integers.
#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