Created
May 15, 2012 04:19
-
-
Save AtnNn/2699087 to your computer and use it in GitHub Desktop.
foo(BAR, 42); foo(QUX, "hallo")
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> | |
union zig { | |
int num; | |
char *str; | |
}; | |
enum pop { BAR, QUX }; | |
void foo_ (enum pop p, union zig z){ | |
putchar( p == BAR ? z.num : z.str[0] ); | |
} | |
#define foo(p, z) foo_(p, (union zig) z) | |
int main(){ | |
foo(BAR, 90); | |
foo(QUX, "\n"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment