This file contains 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"); | |
pub fn main() !void { | |
var arena_object = std.heap.ArenaAllocator.init(std.heap.direct_allocator); | |
defer arena_object.deinit(); | |
const arena = &arena_object.allocator; | |
std.debug.warn("Please enter a new title to add in the library:\n"); | |
var buf = try std.Buffer.initSize(arena, 0); | |
const title = try std.io.readLine(&buf); |
This file contains 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
test "" { | |
var argv: [*:null]const ?[*:0]const u8 = &[_:null] ?[*:0]const u8{ | |
"one", | |
"two", | |
null, | |
}; | |
} |
This file contains 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"); | |
pub fn main() !void { | |
var arena_impl = std.heap.ArenaAllocator.init(std.heap.page_allocator); | |
const arena = &arena_impl.allocator; | |
defer arena_impl.deinit(); | |
var buf = try std.Buffer.init(arena, ""); | |
var in_impl = std.io.getStdIn().inStream(); | |
var in = &in_impl.stream; |
This file contains 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
packed_struct.md -- the main document is a comment because big fonts suck |
This file contains 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"); | |
pub fn main() !void { | |
const heap = std.heap.c_allocator; | |
// comptime length | |
{ | |
var ct = [_]f32{ 1.0, 2.0 }; | |
const r = try foo(heap, ct); | |
std.debug.warn("\ntype: {}\n", .{@typeName(@TypeOf(r))}); |
This file contains 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
fn foo(list: []const u8) { | |
while (i < end) : (i += 1) { | |
var i: usize = 0, | |
const end: usize = 10, | |
std.debug.warn("[{}] = {}\n", .{i,list[i]}); | |
} | |
} |
This file contains 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
#!/usr/bin/env bash | |
set -e | |
################################################################################ | |
# | |
# note: if building with gcc you might need ~1.5-2.0 GiB per concurrent job | |
# | |
# apt install git vim ruby cmake ninja-build | |
# |
This file contains 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
... |
This file contains 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
diff --git a/linux-user/signal.c b/linux-user/signal.c | |
index 8cf51ffecd..a006f7b025 100644 | |
--- a/linux-user/signal.c | |
+++ b/linux-user/signal.c | |
@@ -25,6 +25,13 @@ | |
#include "trace.h" | |
#include "signal-common.h" | |
+#ifndef __SIGRTMIN | |
+#define __SIGRTMIN 32 |
This file contains 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
export fn foo1() void { | |
comptime { | |
var buf = [_]u8{ 'a', 'b', 'c', 'd' } ++ [_]u8{undefined} ** 10; | |
var target: [*]u8 = &buf; | |
const slice = target[0..3 :0]; | |
// above after resolving slice instruction target, | |
// debugger shows `target`: (ZigValue).data.x_ptr.special == ConstPtrSpecialBaseArray | |
} | |
} |
OlderNewer