Skip to content

Instantly share code, notes, and snippets.

#include <uv.h>
#include <stdlib.h>
#include <stdio.h>
#define PRINT_UV_ERR(prefix, code) do {\
fflush(stdout);\
fprintf(stderr, "%s: %s (%i): %s\n", prefix, uv_err_name(code), (int)(code), uv_strerror(code));\
fflush(stderr);\
@mmaxs
mmaxs / cleanup-test.c
Last active May 25, 2020 10:29
__attribbute__(( cleanup(...) )) quirk
/* gcc -std=c11 -Wall -Wpedantic -pedantic-errors -D_DEFAULT_SOURCE cleanup-test.c -o cleanup-test */
#include <stdlib.h>
#include <stdio.h>
struct Obj { int x; };
void Obj_cleanup(struct Obj **obj_ref)
@mmaxs
mmaxs / vis-ha.cpp
Last active June 11, 2020 08:55
the Visitor pattern
// g++ -std=c++1z -Wall -Wpedantic -pedantic-errors -O2 -D__USE_MINGW_ANSI_STDIO vis-ha.cpp -o vis-ha
#include <cstdio>
#include <typeinfo>
#include <vector>
#include <utility>
class Pass;