Skip to content

Instantly share code, notes, and snippets.

@goshhhy
Created October 24, 2019 20:06
Show Gist options
  • Save goshhhy/8edc03d603233f0e2b78a2ed20ad2feb to your computer and use it in GitHub Desktop.
Save goshhhy/8edc03d603233f0e2b78a2ed20ad2feb to your computer and use it in GitHub Desktop.
//
// C code I'm trying to represent
//
static const char *resolutions[] = {
"[320 240 ]",
"[400 300 ]",
"[512 384 ]",
"[640 480 ]",
"[800 600 ]",
"[960 720 ]",
"[1024 768 ]",
"[1152 864 ]",
"[1280 1024]",
"[1600 1200]",
0
};
//
// the Zig code i've written to replace it
//
const resolutions = [*][*]const u8 {
c"[320 240 ]",
c"[400 300 ]",
c"[512 384 ]",
c"[640 480 ]",
c"[800 600 ]",
c"[960 720 ]",
c"[1024 768 ]",
c"[1152 864 ]",
c"[1280 1024]",
c"[1600 1200]",
null,
};
//
// Compiler message that results
//
~/c/fake2   *  zig build 358ms  Thu 24 Oct 2019 01:05:13 PM PDT
Unreachable at /deps/zig/src/ir.cpp:17482 in ir_analyze_instruction_elem_ptr. This is a bug in the Zig compiler.
Unable to dump stack trace: debug info stripped
The following command terminated unexpectedly:
/snap/zig/890/zig build-obj /home/goshhhy/code/fake2/src/platform/zigsdl/swimp_sdl.zig --library c --library SDL2 --cache-dir /home/goshhhy/code/fake2/zig-cache --name swimp_sdl -isystem /usr/include/SDL2 -isystem /home/goshhhy/code/fake2/src -isystem /usr/local/include -isystem /usr/include/x86_64-linux-gnu -isystem /usr/include --library-path /usr/local/lib --library-path /usr/lib/x86_64-linux-gnu --library-path /usr/lib --library-path /lib/x86_64-linux-gnu -D _REENTRANT --cache on
Build failed. The following command failed:
/home/goshhhy/code/fake2/zig-cache/o/Oxrxg2ksEbrsppjQ6pWpbUd7ImcdCCKvvfLIKP97ICQ27lAE2JbXvKaw-RFAeu_l/build /snap/zig/890/zig /home/goshhhy/code/fake2 /home/goshhhy/code/fake2/zig-cache
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment