Skip to content

Instantly share code, notes, and snippets.

View raalkml's full-sized avatar

Alex Riesen raalkml

View GitHub Profile
@raalkml
raalkml / smiley.c
Created September 18, 2012 07:52 — forked from anastasop/smiley.c
smiley.c
// the smiley program demonstrated by Russ Cox at http://research.swtch.com/acme
// it shows that the plan9 compiler http://plan9.bell-labs.com/sys/doc/comp.html fully supports UTF-8
// i tried to compile it with a recent version of the plan9 compiler running on vmware but it failed.
// it seems that older versions of the compiler supported sizeof(void) == 0
// anyway you get the idea
#include <u.h>
#include <libc.h>
@raalkml
raalkml / insane_kernel_macro_solution.c
Created April 12, 2012 09:48 — forked from hank/insane_kernel_macro_solution.c
The solution to Linus' question on resolving undefined macros in the preprocessor to 0, as well as resolving defined macros to their values.
#include <stdio.h>
#define CONFIG_FOO 1
#define CONFIG_NOO 0
#define is_set(macro) is_set_(macro)
#define macrotest_1 ,
#define is_set_(value) is_set__(macrotest_##value)
#define is_set__(comma) is_set___(comma 1, 0)
#define is_set___(_, v, ...) v