Skip to content

Instantly share code, notes, and snippets.

View jorangreef's full-sized avatar

Joran Dirk Greef jorangreef

View GitHub Profile
@jorangreef
jorangreef / binding.c
Created March 9, 2019 15:13
get_buffer()
#include <assert.h>
#include <limits.h>
#include <node_api.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
static int arg_buf(
napi_env env,
napi_value value,
@jorangreef
jorangreef / gist:77e7c609a15c6bea2ed749340c6ae9b3
Created September 9, 2020 14:48
stack or result location semantics
fn stack_or_result_location_semantics() custom_struct {
var custom_structs: [1]custom_struct = undefined;
fill_in_custom_struct(&custom_structs, 1);
return custom_structs[0];
}
fn boom_or_safe() void {
var custom_struct = stack_or_result_location_semantics();
}