TRUE, FALSE, NOT in C
友達と話題になったので、記録しておこう。
#define TRUE 1 #define FALSE 0 #define NOT(b) b ^ 1
よくやりますよね。こういうの。
テストコード:
#include <stdio.h> #define TRUE 1 #define FALSE 0 #define NOT(b) b ^ 1 int main(int argc, char** argv){ printf("NOT(TRUE) = %d\n", NOT(TRUE)); printf("NOT(FALSE) = %d\n", NOT(FALSE)); }