Skip to content

Instantly share code, notes, and snippets.

@Golevka
Golevka / call_varg.c
Created July 1, 2013 13:45
Calling C functions with parameter lists, does not play well with structs or doubles.
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
void *__call_varg_impl(void *f, int n_args, void **argv)
{
unsigned int param[n_args];
int ret;
memcpy(param, argv, n_args * sizeof(void*));
@Golevka
Golevka / meta_list.cc
Created May 27, 2013 13:13
Compile time list as well as some higher order functions implemented with Grand Functional Spirit of SICP
#include <iostream>
struct meta_nil { };
template <int I, typename _ty_cdr>
struct meta_cons {
static const int car = I;
typedef _ty_cdr cdr;
};