This file contains hidden or 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
int main(int argc, char **argv) { | |
struct SoundIo *soundio = soundio_create(); | |
if (!soundio) { | |
fprintf(stderr, "out of memory\n"); | |
return 1; | |
} | |
int err; | |
if ((err = soundio_connect(soundio))) { | |
fprintf(stderr, "unable to connect: %s\n", soundio_strerror(err)); | |
soundio_destroy(soundio); |
This file contains hidden or 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
const std = @import("std"); | |
const builtin = @import("builtin"); | |
export fn captureStackTrace(addresses: [*]usize, len: usize, first_addr: usize) void { | |
var trace = builtin.StackTrace{ | |
.instruction_addresses = addresses[0..len], | |
.index = 0, | |
}; | |
std.debug.captureStackTrace(if (first_addr == 0) null else first_addr, &trace); | |
} |
This file contains hidden or 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
c:\msys64\home\andy\dev\zig\build-release-llvm8>bin\zig.exe libc | |
# The directory that contains `stdlib.h`. | |
# On POSIX-like systems, include directories be found with: `cc -E -Wp,-v -xc /dev/null` | |
include_dir=C:\Program Files (x86)\Windows Kits\10\\Include\10.0.17134.0\ucrt | |
# The system-specific include directory. May be the same as `include_dir`. | |
# On Windows it's the directory that includes `vcruntime.h`. | |
# On POSIX it's the directory that includes `sys/errno.h`. | |
sys_include_dir=C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\lib\x64\\..\..\include | |
# The directory that contains `crt1.o`. |
This file contains hidden or 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
modified: libc/include/generic-musl/linux/netfilter/xt_CONNMARK.h | |
modified: libc/include/generic-musl/linux/netfilter/xt_DSCP.h | |
modified: libc/include/generic-musl/linux/netfilter/xt_MARK.h | |
modified: libc/include/generic-musl/linux/netfilter/xt_RATEEST.h | |
modified: libc/include/generic-musl/linux/netfilter/xt_TCPMSS.h | |
modified: libc/include/generic-musl/linux/netfilter_ipv4/ipt_ECN.h | |
modified: libc/include/generic-musl/linux/netfilter_ipv4/ipt_TTL.h | |
modified: libc/include/generic-musl/linux/netfilter_ipv6/ip6t_HL.h |
This file contains hidden or 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
const std = @import("std"); | |
const os = std.os; | |
const src = "/home/andy/downloads/glibc"; | |
const j_arg = "-j2"; | |
const configure = src ++ "/configure"; | |
const Target = struct { | |
glibc_name: []const u8, |
This file contains hidden or 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
start.os: gcc ../sysdeps/x86_64/start.S -c -I../include -I/home/andy/downloads/glibc/build/csu -I/home/andy/downloads/glibc/build -I../sysdeps/unix/sysv/linux/x86_64/64 -I../sysdeps/unix/sysv/linux/x86_64 -I../sysdeps/unix/sysv/linux/x86/include -I../sysdeps/unix/sysv/linux/x86 -I../sysdeps/x86/nptl -I../sysdeps/unix/sysv/linux/wordsize-64 -I../sysdeps/x86_64/nptl -I../sysdeps/unix/sysv/linux/include -I../sysdeps/unix/sysv/linux -I../sysdeps/nptl -I../sysdeps/pthread -I../sysdeps/gnu -I../sysdeps/unix/inet -I../sysdeps/unix/sysv -I../sysdeps/unix/x86_64 -I../sysdeps/unix -I../sysdeps/posix -I../sysdeps/x86_64/64 -I../sysdeps/x86_64/fpu/multiarch -I../sysdeps/x86_64/fpu -I../sysdeps/x86/fpu/include -I../sysdeps/x86/fpu -I../sysdeps/x86_64/multiarch -I../sysdeps/x86_64 -I../sysdeps/x86 -I../sysdeps/ieee754/float128 -I../sysdeps/ieee754/ldbl-96/include -I../sysdeps/ieee754/ldbl-96 -I../sysdeps/ieee754/dbl-64/wordsize-64 -I../sysdeps/ieee754/dbl-64 -I../sysdeps/ieee754/flt-32 -I.. |
This file contains hidden or 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
# with dumpCurrentStackTrace commented out | |
execve("./test", ["./test"], 0x7ffc4946bd00 /* 131 vars */) = 0 | |
rt_sigaction(SIGSEGV, {sa_handler=0x2030b0, sa_mask=[], sa_flags=SA_RESTORER|SA_RESETHAND, sa_restorer=0x223d10}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0 | |
--- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0x1} --- | |
rt_sigreturn({mask=[]}) = 0 | |
--- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0x1} --- | |
+++ killed by SIGSEGV +++ | |
Segmentation fault |
This file contains hidden or 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
const std = @import("std"); | |
const Timer = std.os.time.Timer; | |
const IntType = i32; | |
const vector_size = 4; | |
const total_vectors = 100000000; | |
const total_integers = total_vectors * vector_size; | |
test "bench" { | |
const bytes = @sizeOf(IntType) * total_integers; |
This file contains hidden or 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
const S = struct { | |
a: usize, | |
b: usize, | |
}; | |
fn foo() S { | |
var result: S return = undefined; | |
result.a = 1234; | |
result.b = 5678; | |
// returning the return var is specially detected |
This file contains hidden or 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
Here's a bunch of stuff I found in referrer URL to ziglang.org. | |
I'm not stating any opinions on any of this content, just exposing the information. | |
--- | |
http://chriswarbo.net/blog/2017-03-03-free_elves.html | |
> Note that while Haskell doesn't have a "compile-time phase" (unlike, say, Zig), we can use Template Haskell to mess around with the syntax tree during compilation, which seems to be enough for our purposes. | |
> if I were really going to implement such a thing, I'd maybe target something more low-level (e.g. without garbage collection, RTS, etc.) so that I could tease out as much performance as possible. Languages like Zig, Terra, Nim or Rust. | |