# Help

**URL:** https://ziggit.dev/c/help/6.md?page=2

[Latest](https://ziggit.dev/latest.md) · [Categories](https://ziggit.dev/categories.md) · [Tags](https://ziggit.dev/tags.md)

**Page:** 3

---

## [MultiArrayList over \[\]\[\]u8?](https://ziggit.dev/t/multiarraylist-over-u8/17527)

<div class="topic-metadata">

**Author:** [@jangorecki](https://ziggit.dev/u/jangorecki)\
**Replies:** 11\
**Last updated:** [September 9, 2026, 5:24pm UTC](https://ziggit.dev/t/multiarraylist-over-u8/17527 "2026-09-09T17:24:29Z")

</div>

Is there any overhead for using MultiArrayList to keep my pointers to pointers to data over using \[\]\[\]u8 for that? How does that scale with increasing number of pointers, let’s say up to 65K (u16) comparing with \[\]\[\]u8? …

---

## [A question on memory](https://ziggit.dev/t/a-question-on-memory/17542)

<div class="topic-metadata">

**Author:** [@devengel](https://ziggit.dev/u/devengel)\
**Replies:** 1\
**Last updated:** [September 9, 2026, 4:17pm UTC](https://ziggit.dev/t/a-question-on-memory/17542 "2026-09-09T16:17:31Z")

</div>

fn bar(allocator:std.mem.allocator) \[\]Foo { var foo: \[\]Foo = try allocator.alloc(Foo, 3); return foo\[..2\]; } with the above function, the function that calls bar frees the returned slice. question is, is this …

---

## [How to see output of custom build step?](https://ziggit.dev/t/how-to-see-output-of-custom-build-step/17534)

<div class="topic-metadata">

**Author:** [@hvbargen](https://ziggit.dev/u/hvbargen)\
**Replies:** 4\
**Last updated:** [September 9, 2026, 8:15am UTC](https://ziggit.dev/t/how-to-see-output-of-custom-build-step/17534 "2026-09-09T08:15:59Z")

</div>

I’m using a custom build step called “precompile” to generate some Zig source files with Zig 0.16. The precompile step has 2 parts: One part uses a Python script to generate a Zig file, the other part uses a Zig program…

---

## [Which is considered best practice in zig?](https://ziggit.dev/t/which-is-considered-best-practice-in-zig/17528)

<div class="topic-metadata">

**Author:** [@vic1500](https://ziggit.dev/u/vic1500)\
**Replies:** 5\
**Last updated:** [September 7, 2026, 8:41pm UTC](https://ziggit.dev/t/which-is-considered-best-practice-in-zig/17528 "2026-09-07T20:41:43Z")

</div>

Hi, so I recently got into zig (and systems programming as a whole) about 3 months ago and let’s just say I don’t know enough to know what’s considered best practice. So let’s say you have a generic data structure… Some…

---

## [Is Parameter Reference Optimization still a thing since Zig 0.16?](https://ziggit.dev/t/is-parameter-reference-optimization-still-a-thing-since-zig-0-16/17516)

<div class="topic-metadata">

**Author:** [@zigo](https://ziggit.dev/u/zigo)\
**Replies:** 6\
**Last updated:** [September 7, 2026, 8:50am UTC](https://ziggit.dev/t/is-parameter-reference-optimization-still-a-thing-since-zig-0-16/17516 "2026-09-07T08:50:07Z")

</div>

It looks the issue says PRO is gone. But the official docs still says: … When these types are passed as parameters, Zig may choose to copy and pass by value, or pass by reference, whichever way Zig decides will be fas…

---

## [Endless llvm emit object with release on linux](https://ziggit.dev/t/endless-llvm-emit-object-with-release-on-linux/17464)

<div class="topic-metadata">

**Author:** [@ppipelin](https://ziggit.dev/u/ppipelin)\
**Replies:** 4\
**Last updated:** [September 6, 2026, 2:15pm UTC](https://ziggit.dev/t/endless-llvm-emit-object-with-release-on-linux/17464 "2026-09-06T14:15:17Z")

</div>

I run into an endless LLVM Emit Object when building on linux. On windows it takes 40 seconds but it is compiling correctly. I tested linux with a windows WSL2. I suspect the use of @embedFile builtin as a long llvm emi…

---

## [Middleware design seem very hard to do correct](https://ziggit.dev/t/middleware-design-seem-very-hard-to-do-correct/17492)

<div class="topic-metadata">

**Author:** [@liteflow10](https://ziggit.dev/u/liteflow10)\
**Replies:** 3\
**Last updated:** [September 6, 2026, 10:09am UTC](https://ziggit.dev/t/middleware-design-seem-very-hard-to-do-correct/17492 "2026-09-06T10:09:45Z")

</div>

I’m creating an http micro-framework and the thing I can’t fully understand is middlewares. I’ve looked up zap to see how they do this, but they only do global chain of middlewares, which I don’t personally like. I woul…

---

## [\`Io.Reader\` buffer and \`peek\` paradox](https://ziggit.dev/t/io-reader-buffer-and-peek-paradox/17455)

<div class="topic-metadata">

**Author:** [@benburkert](https://ziggit.dev/u/benburkert)\
**Replies:** 9\
**Last updated:** [September 6, 2026, 7:52am UTC](https://ziggit.dev/t/io-reader-buffer-and-peek-paradox/17455 "2026-09-06T07:52:11Z")

</div>

I am probably overthinking something, but I’ve hit a bit of a quandary while trying to support peek for a base64 Io.Reader implementation. The issue is that peek expects stream to fill up to the full buffer for the Io.Re…

---

## [Where should Allocators be created?](https://ziggit.dev/t/where-should-allocators-be-created/17487)

<div class="topic-metadata">

**Author:** [@luihabl](https://ziggit.dev/u/luihabl)\
**Replies:** 4\
**Last updated:** [September 5, 2026, 9:28pm UTC](https://ziggit.dev/t/where-should-allocators-be-created/17487 "2026-09-05T21:28:55Z")

</div>

Hi all, sorry if this has been asked before. I’m a C++ developer and as a first simple project to learn zig I’m making a simple 2D game using SDL. One thing that still isn’t clear for the language is where exactly an all…

---

## [Feedback: simple SIMD powered string pattern search over text files recursively](https://ziggit.dev/t/feedback-simple-simd-powered-string-pattern-search-over-text-files-recursively/17462)

<div class="topic-metadata">

**Author:** [@lukeflo](https://ziggit.dev/u/lukeflo)\
**Replies:** 8\
**Last updated:** [September 5, 2026, 5:30pm UTC](https://ziggit.dev/t/feedback-simple-simd-powered-string-pattern-search-over-text-files-recursively/17462 "2026-09-05T17:30:39Z")

</div>

Hi, I’m looking for some feedback on my example code and hope for some suggestions/tipps what can be done better :slightly\_smiling\_face: The goal is to search all textfiles of a nested directory tree and return those w…

---

## [Call and spawn new process with stdin](https://ziggit.dev/t/call-and-spawn-new-process-with-stdin/17177)

<div class="topic-metadata">

**Author:** [@removewingman](https://ziggit.dev/u/removewingman)\
**Replies:** 7\
**Last updated:** [September 5, 2026, 1:01pm UTC](https://ziggit.dev/t/call-and-spawn-new-process-with-stdin/17177 "2026-09-05T13:01:41Z")

</div>

I want to call a process and provide stdin and get stdout how to do that? The pipe gives and takes a file and I do not know how to read it or create one from just hard coded string, this is somewhat pseudo code, any ide…

---

## [Track transferred bytes/progress of longer PUT request with std.http](https://ziggit.dev/t/track-transferred-bytes-progress-of-longer-put-request-with-std-http/16445)

<div class="topic-metadata">

**Author:** [@lukeflo](https://ziggit.dev/u/lukeflo)\
**Replies:** 25\
**Last updated:** [September 5, 2026, 11:20am UTC](https://ziggit.dev/t/track-transferred-bytes-progress-of-longer-put-request-with-std-http/16445 "2026-09-05T11:20:12Z")

</div>

Hey, I want to send bigger chunks of data from a local machine to a storage system using std.http methods. Because the data can be up to some tens or even hundred GiB, it would be nice to track the progress so the user …

---

## [Is the syntax inconsistency intentional?](https://ziggit.dev/t/is-the-syntax-inconsistency-intentional/17486)

<div class="topic-metadata">

**Author:** [@zigo](https://ziggit.dev/u/zigo)\
**Replies:** 4\
**Last updated:** [September 5, 2026, 10:36am UTC](https://ziggit.dev/t/is-the-syntax-inconsistency-intentional/17486 "2026-09-05T10:36:59Z")

</div>

const print = @import("std").debug.print; fn bar(n: i8) !usize { return if (n \<= 0) error.A else 123; } pub fn main() !void { while (bar(0)) |\_| { // The capture is optional. unreachable; } else |\_|…

---

## [Assert triggered in std.Io.Task.start](https://ziggit.dev/t/assert-triggered-in-std-io-task-start/17447)

<div class="topic-metadata">

**Author:** [@Southporter](https://ziggit.dev/u/Southporter)\
**Replies:** 9\
**Last updated:** [September 4, 2026, 6:43pm UTC](https://ziggit.dev/t/assert-triggered-in-std-io-task-start/17447 "2026-09-04T18:43:28Z")

</div>

I’ve been consistently running into an assert in the standard library. I’ve been trying to figure out what is causing it, and I have been unable to reduce it to a small reproduction so I can write up a bug report on the …

---

## [Why does the second \`untilNow\` take 5us extra?](https://ziggit.dev/t/why-does-the-second-untilnow-take-5us-extra/17461)

<div class="topic-metadata">

**Author:** [@felixrabe](https://ziggit.dev/u/felixrabe)\
**Replies:** 11\
**Last updated:** [September 3, 2026, 7:28pm UTC](https://ziggit.dev/t/why-does-the-second-untilnow-take-5us-extra/17461 "2026-09-03T19:28:10Z")

</div>

This Zig 0.16 example: const std = @import("std"); pub fn main(init: std.process.Init) !void { const io = init.io; const clk: std.Io.Clock = .awake; const start\_time = clk.now(io); const t1 = start\_ti…

---

## [Has anyone tried build Zig from source on macOS without prebuilt Zig?](https://ziggit.dev/t/has-anyone-tried-build-zig-from-source-on-macos-without-prebuilt-zig/17457)

<div class="topic-metadata">

**Author:** [@zeeqeeng](https://ziggit.dev/u/zeeqeeng)\
**Replies:** 7\
**Last updated:** [September 3, 2026, 4:44am UTC](https://ziggit.dev/t/has-anyone-tried-build-zig-from-source-on-macos-without-prebuilt-zig/17457 "2026-09-03T04:44:44Z")

</div>

It’s the problem only on macOS. I want learn some experience of you guys cuz it’s kind of annoying with these factors together: I don’t want to use Homebrew to fetch libraries for some reason CMake will always find lib…

---

## [Why does this print "1"](https://ziggit.dev/t/why-does-this-print-1/17430)

<div class="topic-metadata">

**Author:** [@elpablete](https://ziggit.dev/u/elpablete)\
**Replies:** 10\
**Last updated:** [September 1, 2026, 2:48pm UTC](https://ziggit.dev/t/why-does-this-print-1/17430 "2026-09-01T14:48:57Z")

</div>

Why does this print “1” instead of a a bunch of zeros, and a ‘1’? const std = @import("std"); pub fn main() void { std.debug.print("binary {b}", .{ @as(u32, 1)}); }

---

## [Segmentation fault after flushing to stdout](https://ziggit.dev/t/segmentation-fault-after-flushing-to-stdout/16799)

<div class="topic-metadata">

**Author:** [@o-wrobel](https://ziggit.dev/u/o-wrobel)\
**Replies:** 5\
**Last updated:** [September 1, 2026, 8:07am UTC](https://ziggit.dev/t/segmentation-fault-after-flushing-to-stdout/16799 "2026-09-01T08:07:48Z")

</div>

I’m trying to use the Writer.print function, but upon flushing I get this segfault: Segmentation fault at address 0x79 /nix/store/d0kkd93aji32klh4npp5fzq82lb84p85-zig-0.16.0/lib/zig/std/Io.zig:453:29: 0x1039fb3 in opera…

---

## [Need help understanding testing](https://ziggit.dev/t/need-help-understanding-testing/17431)

<div class="topic-metadata">

**Author:** [@miagi](https://ziggit.dev/u/miagi)\
**Replies:** 5\
**Last updated:** [September 1, 2026, 7:50am UTC](https://ziggit.dev/t/need-help-understanding-testing/17431 "2026-09-01T07:50:39Z")

</div>

I don’t have pretty much any experience in what should be tested in a code. I have an idea that every function should test just it’s own functionality and avoid testing the functionality of the function it calls. Is this…

---

## [Why casting an empty slice to a pointer isn't checked?](https://ziggit.dev/t/why-casting-an-empty-slice-to-a-pointer-isnt-checked/6986)

<div class="topic-metadata">

**Author:** [@tekhnus](https://ziggit.dev/u/tekhnus)\
**Replies:** 4\
**Last updated:** [August 31, 2026, 4:07pm UTC](https://ziggit.dev/t/why-casting-an-empty-slice-to-a-pointer-isnt-checked/6986 "2026-08-31T16:07:48Z")

</div>

Hi everyone! I noticed that casting an empty slice to a pointer doesn’t produce an error by itself. For example, the following code: const std = @import("std"); pub fn getSlice() \[\]i32 { return &.{}; } pub fn ma…

---

## [Is asn1 encoder broken?](https://ziggit.dev/t/is-asn1-encoder-broken/17428)

<div class="topic-metadata">

**Author:** [@pythonic01](https://ziggit.dev/u/pythonic01)\
**Replies:** 11\
**Last updated:** [August 31, 2026, 3:02pm UTC](https://ziggit.dev/t/is-asn1-encoder-broken/17428 "2026-08-31T15:02:15Z")

</div>

Hello everyone. am working on something with SNMP and i wanted to use the ASN1 module from the std lib however when i tried to run this example i got this error message pub fn main(init: std.process.Init) !void { co…

---

## [I know @TypeOf in unusual sometimes, but I'm not sure if consistency should made here](https://ziggit.dev/t/i-know-typeof-in-unusual-sometimes-but-im-not-sure-if-consistency-should-made-here/17416)

<div class="topic-metadata">

**Author:** [@zigo](https://ziggit.dev/u/zigo)\
**Replies:** 9\
**Last updated:** [August 31, 2026, 12:19pm UTC](https://ziggit.dev/t/i-know-typeof-in-unusual-sometimes-but-im-not-sure-if-consistency-should-made-here/17416 "2026-08-31T12:19:06Z")

</div>

Should T1 == T2 in the following code? const E = error {A, B}; fn foo(b: bool) E!noreturn { return if (b) E.A else while (true) {}; } var c = false; pub fn main() void { const T1 = @TypeOf( foo(c)…

---

## [Is there any way to address this?](https://ziggit.dev/t/is-there-any-way-to-address-this/17426)

<div class="topic-metadata">

**Author:** [@Drk](https://ziggit.dev/u/Drk)\
**Replies:** 4\
**Last updated:** [August 30, 2026, 8:59pm UTC](https://ziggit.dev/t/is-there-any-way-to-address-this/17426 "2026-08-30T20:59:12Z")

</div>

Currently I’m doing a little project to learn Zig and network protocols, TCP, UDP, IRC, Tor, etc., and, doing a practical implementation: a file-transfer application, but i had an issue when it iterates over the argument…

---

## [Planar Geometric Pattern Matching](https://ziggit.dev/t/planar-geometric-pattern-matching/17421)

<div class="topic-metadata">

**Author:** [@TheDarkUndoing](https://ziggit.dev/u/TheDarkUndoing)\
**Replies:** 6\
**Last updated:** [August 30, 2026, 4:41pm UTC](https://ziggit.dev/t/planar-geometric-pattern-matching/17421 "2026-08-30T16:41:52Z")

</div>

Fig. 1 - Visual representation of a “complete pattern” as seen from the perspective of viewing the board Fig. 2 - A valid game pattern orientation outside the “complete pattern”\* Fig. 3 - Representation of how the b…

---

## [Why do Zig, Rust and Julia give different random numbers when I give them the same seed and algorithm?](https://ziggit.dev/t/why-do-zig-rust-and-julia-give-different-random-numbers-when-i-give-them-the-same-seed-and-algorithm/17422)

<div class="topic-metadata">

**Author:** [@allonsyeet](https://ziggit.dev/u/allonsyeet)\
**Replies:** 4\
**Last updated:** [August 30, 2026, 4:14pm UTC](https://ziggit.dev/t/why-do-zig-rust-and-julia-give-different-random-numbers-when-i-give-them-the-same-seed-and-algorithm/17422 "2026-08-30T16:14:24Z")

</div>

I have this sample code snippet in Zig that generates 10 random f32 and puts them in a slice. const std = @import("std"); pub fn main() void { var prng\_state = std.Random.Xoshiro256.init(0); const prng = prng\_s…

---

## [Is the order of function argument evaluation stable?](https://ziggit.dev/t/is-the-order-of-function-argument-evaluation-stable/17415)

<div class="topic-metadata">

**Author:** [@felixrabe](https://ziggit.dev/u/felixrabe)\
**Replies:** 5\
**Last updated:** [August 30, 2026, 6:34am UTC](https://ziggit.dev/t/is-the-order-of-function-argument-evaluation-stable/17415 "2026-08-30T06:34:24Z")

</div>

So I’m just watching https://www.youtube.com/watch?v=69pvUyBsruQ&t=2h15m19s and Simon Carter is referencing a difference between C compilers / platforms in the order of evaluating function arguments. So this makes me won…

---

## [How to properly read from stdin?](https://ziggit.dev/t/how-to-properly-read-from-stdin/5218)

<div class="topic-metadata">

**Author:** [@Dappster](https://ziggit.dev/u/Dappster)\
**Replies:** 7\
**Last updated:** [August 29, 2026, 7:38pm UTC](https://ziggit.dev/t/how-to-properly-read-from-stdin/5218 "2026-08-29T19:38:04Z")

</div>

So I have a couple issues: const std = @import("std"); //const stdout = std.io.getStdOut().writer(); //const stdin = std.io.getStdIn().reader(); var gpa = std.heap.GeneralPurposeAllocator(.{}){}; var allocator = gpa.all…

---

## [Field defaults in vulkan-zig](https://ziggit.dev/t/field-defaults-in-vulkan-zig/17413)

<div class="topic-metadata">

**Author:** [@dpirch](https://ziggit.dev/u/dpirch)\
**Replies:** 3\
**Last updated:** [August 29, 2026, 4:48pm UTC](https://ziggit.dev/t/field-defaults-in-vulkan-zig/17413 "2026-08-29T16:48:40Z")

</div>

I started using Snektron/vulkan-zig for Vulkan again, but what I find very cumbersome is that most of the struct fields don’t have default values, and you have to set lots of nonsensical values that in C would be set imp…

---

## [Inline else not removing errors](https://ziggit.dev/t/inline-else-not-removing-errors/17406)

<div class="topic-metadata">

**Author:** [@nilsj](https://ziggit.dev/u/nilsj)\
**Replies:** 4\
**Last updated:** [August 29, 2026, 1:00pm UTC](https://ziggit.dev/t/inline-else-not-removing-errors/17406 "2026-08-29T13:00:43Z")

</div>

fn bar() error{ Bar, Foo }!void { return error.Bar; } fn foo() error{Foo}!void { bar() catch |err| switch (err) { error.Bar =\> {}, inline else =\> |e| return e, }; } test { try foo(); } \>…

---

## [How to check if something is a string?](https://ziggit.dev/t/how-to-check-if-something-is-a-string/5857)

<div class="topic-metadata">

**Author:** [@aakashns](https://ziggit.dev/u/aakashns)\
**Replies:** 10\
**Last updated:** [August 29, 2026, 11:49am UTC](https://ziggit.dev/t/how-to-check-if-something-is-a-string/5857 "2026-08-29T11:49:27Z")

</div>

Hi, sorry if this is a noob question, but is there an easy way to check if something is a string (i.e. its type can be coerced to \[\]const u8)? Here’s the function I’m looking to write: fn isString(input: anytype) bool …

[Previous page](https://ziggit.dev/c/help/6.md?page=1)

[Next page](https://ziggit.dev/c/help/6.md?page=3)
