# Explain

**URL:** https://ziggit.dev/c/explain/13.md?page=2

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

**Page:** 3

---

## [Canonical Cross Compiling w/ System Dependencies, PKG Config, --sysroot and --search-prefix?](https://ziggit.dev/t/canonical-cross-compiling-w-system-dependencies-pkg-config-sysroot-and-search-prefix/17568)

<div class="topic-metadata">

**Author:** [@nat3Github](https://ziggit.dev/u/nat3Github)\
**Replies:** 0\
**Last updated:** [September 11, 2026, 3:52pm UTC](https://ziggit.dev/t/canonical-cross-compiling-w-system-dependencies-pkg-config-sysroot-and-search-prefix/17568 "2026-09-11T15:52:24Z")

</div>

a lot of projects use system dependencies - link xy.so or parse xy.h. some build steps even include host-tools-with-system-dependencies. As i understand the zig build system has following mechanisms: per module/step: …

---

## [Learning Zig](https://ziggit.dev/t/learning-zig/17549)

<div class="topic-metadata">

**Author:** [@Wauuuu](https://ziggit.dev/u/Wauuuu)\
**Replies:** 6\
**Last updated:** [September 10, 2026, 11:47am UTC](https://ziggit.dev/t/learning-zig/17549 "2026-09-10T11:47:10Z")

</div>

Hello guys, this is my first time learning Zig and programming. Why I am getting stuck at while loop in this code below if I typing let say “Jack”, sorry If my question doesn’t make sense and sorry my English is not that…

---

## [Too many VMA with SMPAllocator](https://ziggit.dev/t/too-many-vma-with-smpallocator/17529)

<div class="topic-metadata">

**Author:** [@PauSolerValades](https://ziggit.dev/u/PauSolerValades)\
**Replies:** 4\
**Last updated:** [September 8, 2026, 12:31pm UTC](https://ziggit.dev/t/too-many-vma-with-smpallocator/17529 "2026-09-08T12:31:55Z")

</div>

Hello everyone! I want to explain to you a problem that I had and how did I solve it to get some feedback and check if my architecture might have been different! You can find the code I am describing at the repo, the b…

---

## [Design of Io.File.MultiReader?](https://ziggit.dev/t/design-of-io-file-multireader/17488)

<div class="topic-metadata">

**Author:** [@psznm](https://ziggit.dev/u/psznm)\
**Replies:** 2\
**Last updated:** [September 5, 2026, 8:33pm UTC](https://ziggit.dev/t/design-of-io-file-multireader/17488 "2026-09-05T20:33:50Z")

</div>

Why is MultiReader designed the way it is? Why contexts: \[n\]\[@sizeOf(Context)\]u8 align(@alignOf(Context)) and not just contexts: \[n\]Context Why the stuff with casting Buffer to Streams that hides the data? - I just rea…

---

## [What are we expecting in 0.17?](https://ziggit.dev/t/what-are-we-expecting-in-0-17/17438)

<div class="topic-metadata">

**Author:** [@IbrahimOuhamou](https://ziggit.dev/u/IbrahimOuhamou)\
**Replies:** 24\
**Last updated:** [September 4, 2026, 9:29pm UTC](https://ziggit.dev/t/what-are-we-expecting-in-0-17/17438 "2026-09-04T21:29:46Z")

</div>

a long time has passed since 0.16, I didn’t really find that many compilation errors upgrading from 0.16 (except ‘++’ and ‘\*\*’) it doesn’t have to be accurate, just what comes to mind

---

## [When to use builtins vs std.math? log, log10, log2, other?](https://ziggit.dev/t/when-to-use-builtins-vs-std-math-log-log10-log2-other/17433)

<div class="topic-metadata">

**Author:** [@elpablete](https://ziggit.dev/u/elpablete)\
**Replies:** 2\
**Last updated:** [September 1, 2026, 5:24am UTC](https://ziggit.dev/t/when-to-use-builtins-vs-std-math-log-log10-log2-other/17433 "2026-09-01T05:24:20Z")

</div>

Where should @builtins be used instead of std.math functions? And how to decide in a general?

---

## [(Dedicated function for) natural logarithm missing in standard library](https://ziggit.dev/t/dedicated-function-for-natural-logarithm-missing-in-standard-library/10976)

<div class="topic-metadata">

**Author:** [@jbe](https://ziggit.dev/u/jbe)\
**Replies:** 5\
**Last updated:** [August 31, 2026, 9:10pm UTC](https://ziggit.dev/t/dedicated-function-for-natural-logarithm-missing-in-standard-library/10976 "2026-08-31T21:10:40Z")

</div>

Continuing the discussion from Division by zero and Illegal Behavior: “ln” is std.math.log(). There’s also @log(), @log2() and @log10(). That isn’t quite correct. Apparently @log is the natural logarithm, @log2 is t…

---

## [Why not just \`.vtable = @ptrCast(vtable)\`?](https://ziggit.dev/t/why-not-just-vtable-ptrcast-vtable/17388)

<div class="topic-metadata">

**Author:** [@felixrabe](https://ziggit.dev/u/felixrabe)\
**Replies:** 19\
**Last updated:** [August 28, 2026, 8:30am UTC](https://ziggit.dev/t/why-not-just-vtable-ptrcast-vtable/17388 "2026-08-28T08:30:50Z")

</div>

I’m getting a grasp of interfaces, and am deeply unwilling to have to write self = @ptrCast(@alignCast(ptr)) all over the place. There MUST be a better way, no? ( See also: https://www.youtube.com/watch?v=2Q8gB2OXB2E ) …

---

## [What is the logic behind translate c function shortcuts? Is it bugged?](https://ziggit.dev/t/what-is-the-logic-behind-translate-c-function-shortcuts-is-it-bugged/17385)

<div class="topic-metadata">

**Author:** [@psznm](https://ziggit.dev/u/psznm)\
**Replies:** 5\
**Last updated:** [August 27, 2026, 9:48am UTC](https://ziggit.dev/t/what-is-the-logic-behind-translate-c-function-shortcuts-is-it-bugged/17385 "2026-08-27T09:48:37Z")

</div>

So I have recently realized translate-c generates methods on translated opaque structs (realized way too late because ZLS currently does not show them and I rely way too much on LSP). And it is very nice, because it also…

---

## [What kind of errors can or should be handled by the user facing code?](https://ziggit.dev/t/what-kind-of-errors-can-or-should-be-handled-by-the-user-facing-code/17384)

<div class="topic-metadata">

**Author:** [@MeKaLu](https://ziggit.dev/u/MeKaLu)\
**Replies:** 8\
**Last updated:** [August 27, 2026, 9:20am UTC](https://ziggit.dev/t/what-kind-of-errors-can-or-should-be-handled-by-the-user-facing-code/17384 "2026-08-27T09:20:05Z")

</div>

So, lately I have been thinking about API design and this is one of things I can’t really put my finger on it. For the sake of clarity, when I talk about “error” in this post I mean zig errors. Lets say (a hypothetical …

---

## [Why doesn't Zig have std.HashSet?](https://ziggit.dev/t/why-doesnt-zig-have-std-hashset/17363)

<div class="topic-metadata">

**Author:** [@giluis](https://ziggit.dev/u/giluis)\
**Replies:** 5\
**Last updated:** [August 26, 2026, 8:19am UTC](https://ziggit.dev/t/why-doesnt-zig-have-std-hashset/17363 "2026-08-26T08:19:21Z")

</div>

We can use std.HashMap with the Key=\<your set element type\> and Value=void, but seems hacky: the API isn’t as good as it could be e.g. you have to treat keys as your values and disregard a big part of the API. This issu…

---

## [Documentation Io.File.reader](https://ziggit.dev/t/documentation-io-file-reader/17346)

<div class="topic-metadata">

**Author:** [@isaias-dias-machado](https://ziggit.dev/u/isaias-dias-machado)\
**Replies:** 2\
**Last updated:** [August 23, 2026, 9:56pm UTC](https://ziggit.dev/t/documentation-io-file-reader/17346 "2026-08-23T21:56:22Z")

</div>

Hi, I am completely new to zig and wanted to give feedback on the documentation. I was trying to figure out how to read a file so I went over to the documentation and quickly found Io.File and the reader function, the …

---

## [Is \`resume\` a reserved word?](https://ziggit.dev/t/is-resume-a-reserved-word/17334)

<div class="topic-metadata">

**Author:** [@Southporter](https://ziggit.dev/u/Southporter)\
**Replies:** 2\
**Last updated:** [August 22, 2026, 7:32pm UTC](https://ziggit.dev/t/is-resume-a-reserved-word/17334 "2026-08-22T19:32:27Z")

</div>

I’ve run into this in two different projects now. The following fails to compile: // Doesn't compile pub fn resume() void {} // This does pub fn @"resume"() void {} Error: install └─ install repro └─ compile exe r…

---

## [The dot "." overuse](https://ziggit.dev/t/the-dot-overuse/17279)

<div class="topic-metadata">

**Author:** [@mp42](https://ziggit.dev/u/mp42)\
**Replies:** 29\
**Last updated:** [August 21, 2026, 2:09pm UTC](https://ziggit.dev/t/the-dot-overuse/17279 "2026-08-21T14:09:32Z")

</div>

Hello, this is my very first post. I’ve been a casual reader, and the community seems welcoming. (sorry for moving it around, I guess it should be on Explain, i’ll leave it here, if I’m wrong somebody please move to the…

---

## [Proposal: Better lossy casting for int-to-float](https://ziggit.dev/t/proposal-better-lossy-casting-for-int-to-float/17250)

<div class="topic-metadata">

**Author:** [@jpwol](https://ziggit.dev/u/jpwol)\
**Replies:** 24\
**Last updated:** [August 20, 2026, 1:05am UTC](https://ziggit.dev/t/proposal-better-lossy-casting-for-int-to-float/17250 "2026-08-20T01:05:27Z")

</div>

I’m creating a window/graphics library in Zig, and during this process I’ve hit some more headaches with the casting syntax. This stems from the changes with implicit int-to-float conversions (small enough integer can i…

---

## [Debugging Zig (with a debugger)](https://ziggit.dev/t/debugging-zig-with-a-debugger/7160)

<div class="topic-metadata">

**Author:** [@mnemnion](https://ziggit.dev/u/mnemnion)\
**Replies:** 50\
**Last updated:** [August 19, 2026, 3:26am UTC](https://ziggit.dev/t/debugging-zig-with-a-debugger/7160 "2026-08-19T03:26:45Z")

</div>

Debugging Zig code is a bit of a dark art at present:. There’s no official documentation on the subject, and the lore involved is scattered among blog posts, video, Ziggit questions, the Discord, and so on. So I thought…

---

## [Add Unsafe Shift Operators](https://ziggit.dev/t/add-unsafe-shift-operators/17231)

<div class="topic-metadata">

**Author:** [@TheSuperFastOne](https://ziggit.dev/u/TheSuperFastOne)\
**Replies:** 3\
**Last updated:** [August 15, 2026, 7:53am UTC](https://ziggit.dev/t/add-unsafe-shift-operators/17231 "2026-08-15T07:53:20Z")

</div>

For some reason this couldn’t actually go in Brainstorming, cause it’s read-only. Anyways I have a working chess engine in C++, I wanted to see how Zig was, I was hearing some really nice things. Everything worked nicel…

---

## [Why does Deque.at return T instead of ?T](https://ziggit.dev/t/why-does-deque-at-return-t-instead-of-t/17146)

<div class="topic-metadata">

**Author:** [@jlarator](https://ziggit.dev/u/jlarator)\
**Replies:** 12\
**Last updated:** [August 13, 2026, 4:20pm UTC](https://ziggit.dev/t/why-does-deque-at-return-t-instead-of-t/17146 "2026-08-13T16:20:30Z")

</div>

I understand that the implementation for zig 0.16.0 is pub fn at(deque: \*const Self, index: usize) T { assert(index \< deque.len); return deque.buffer\[deque.bufferIndex(index)\]; } I would have expected to be som…

---

## [Auto vectorization of loops](https://ziggit.dev/t/auto-vectorization-of-loops/17164)

<div class="topic-metadata">

**Author:** [@minuanochamploo](https://ziggit.dev/u/minuanochamploo)\
**Replies:** 5\
**Last updated:** [August 12, 2026, 6:00am UTC](https://ziggit.dev/t/auto-vectorization-of-loops/17164 "2026-08-12T06:00:41Z")

</div>

Hi! I’m trying to understand why do I get loop unrolling instead of vectorization in this code (Compiler Explorer)? I definitely know that this C code will be vectorized: void sqr(const int\* restrict src, int\* restrict …

---

## [Unexpected size of union](https://ziggit.dev/t/unexpected-size-of-union/17018)

<div class="topic-metadata">

**Author:** [@giluis](https://ziggit.dev/u/giluis)\
**Replies:** 12\
**Last updated:** [August 11, 2026, 11:21pm UTC](https://ziggit.dev/t/unexpected-size-of-union/17018 "2026-08-11T23:21:26Z")

</div>

Hey! The following code prints 2. I don’t understand why that happens. I expected it to print 1, because the payloads are just 6 bits, meaning the discriminant / tag could be stored in the remaining 2 bits of the 8 bit…

---

## [Surprising side effect using print statements](https://ziggit.dev/t/surprising-side-effect-using-print-statements/17157)

<div class="topic-metadata">

**Author:** [@sickisonfire](https://ziggit.dev/u/sickisonfire)\
**Replies:** 4\
**Last updated:** [August 11, 2026, 6:49am UTC](https://ziggit.dev/t/surprising-side-effect-using-print-statements/17157 "2026-08-11T06:49:15Z")

</div>

Hey! While trying to learn more about zigs internpool i stumbled upon this issue, which i can’t wrap my head around. Simplified Code example: const key: Key = .{ .one = .{ .one = 1234, .two = "hello world" } }; …

---

## [When to use mutex or atomic](https://ziggit.dev/t/when-to-use-mutex-or-atomic/17150)

<div class="topic-metadata">

**Author:** [@jeffective](https://ziggit.dev/u/jeffective)\
**Replies:** 8\
**Last updated:** [August 9, 2026, 3:39pm UTC](https://ziggit.dev/t/when-to-use-mutex-or-atomic/17150 "2026-08-09T15:39:25Z")

</div>

My problem: I’ve got a field of a struct and I need to access the data across multiple io.async and io.concurrent. The data is small (\< 8 bits) I need to read / write from thread 1 and read / write from thread 2. I do …

---

## [Why are the Reader and Writer vtables intrusive as well?](https://ziggit.dev/t/why-are-the-reader-and-writer-vtables-intrusive-as-well/17003)

<div class="topic-metadata">

**Author:** [@paulrt](https://ziggit.dev/u/paulrt)\
**Replies:** 32\
**Last updated:** [August 7, 2026, 10:03pm UTC](https://ziggit.dev/t/why-are-the-reader-and-writer-vtables-intrusive-as-well/17003 "2026-08-07T22:03:53Z")

</div>

I think I get why the buffer needs to be intrusive but why does the vtable have to be as well? Why isn’t it a copyable handle more similar to the Allocator interface? something like this: // std/Io/Writer.zig const W…

---

## [Purely Technical Discussion: Memory-Safe Compilation Mode Inspired by Fil-C](https://ziggit.dev/t/purely-technical-discussion-memory-safe-compilation-mode-inspired-by-fil-c/16813)

<div class="topic-metadata">

**Author:** [@Ray-D-Song](https://ziggit.dev/u/Ray-D-Song)\
**Replies:** 87\
**Last updated:** [August 7, 2026, 11:29am UTC](https://ziggit.dev/t/purely-technical-discussion-memory-safe-compilation-mode-inspired-by-fil-c/16813 "2026-08-07T11:29:01Z")

</div>

We already have a thread discussing this topic here: New Proposal by Andrew: introduce an actually memory safe (unlike Rust) compilation mode inspired by Fil-C But I feel like it has way too much off-topic emotion mixed…

---

## [Errors union should allow compiler to see underlying type. Right?](https://ziggit.dev/t/errors-union-should-allow-compiler-to-see-underlying-type-right/17111)

<div class="topic-metadata">

**Author:** [@ashley.h](https://ziggit.dev/u/ashley.h)\
**Replies:** 2\
**Last updated:** [August 7, 2026, 2:42am UTC](https://ziggit.dev/t/errors-union-should-allow-compiler-to-see-underlying-type-right/17111 "2026-08-07T02:42:42Z")

</div>

Sorry for stupid topic name. Couldn’t imagine anything better. const S1 = struct { a: u32, pub fn init() @This() { return .{ .a = 5 }; } }; const S2 = struct { a: u32, pub fn init() anyerror…

---

## [Questions about mutability, lambdas and many-item pointers](https://ziggit.dev/t/questions-about-mutability-lambdas-and-many-item-pointers/17073)

<div class="topic-metadata">

**Author:** [@memeLord](https://ziggit.dev/u/memeLord)\
**Replies:** 7\
**Last updated:** [August 5, 2026, 7:37pm UTC](https://ziggit.dev/t/questions-about-mutability-lambdas-and-many-item-pointers/17073 "2026-08-05T19:37:32Z")

</div>

Hello there. While I’m still learning about the language, I collected some questions I were bothering me past these days. I’m putting them in one thread to not spam more. It’s known that using of unmodified vars is p…

---

## [Why is Zig (version 0.15.2) generating a \`memcpy\` in this code?](https://ziggit.dev/t/why-is-zig-version-0-15-2-generating-a-memcpy-in-this-code/17064)

<div class="topic-metadata">

**Author:** [@LaBatata101](https://ziggit.dev/u/LaBatata101)\
**Replies:** 3\
**Last updated:** [August 4, 2026, 3:17pm UTC](https://ziggit.dev/t/why-is-zig-version-0-15-2-generating-a-memcpy-in-this-code/17064 "2026-08-04T15:17:28Z")

</div>

In my emulator I have this function: fn vram\_read(self: \*Self, addr: u16) u8 { return self.vram\[self.mirror\_vram\_addr(addr)\]; } vram is defined as vram: \[2048\]u8. In the profiler this simple function is…

---

## [Help understanding error.Canceled](https://ziggit.dev/t/help-understanding-error-canceled/17010)

<div class="topic-metadata">

**Author:** [@Calder-Ty](https://ziggit.dev/u/Calder-Ty)\
**Replies:** 5\
**Last updated:** [July 31, 2026, 6:52am UTC](https://ziggit.dev/t/help-understanding-error-canceled/17010 "2026-07-31T06:52:43Z")

</div>

Ok, I’ll admit I’ve been dragging my feet a bit to understand the ‘new’ Io. Today I’ve been diving into it, and in particular I’m trying to understand when to handle error.Canceled, and when it could happen. From the 0…

---

## [Is there a git tag naming convention or requirement for Zig libraries?](https://ziggit.dev/t/is-there-a-git-tag-naming-convention-or-requirement-for-zig-libraries/16990)

<div class="topic-metadata">

**Author:** [@ieh3oh](https://ziggit.dev/u/ieh3oh)\
**Replies:** 3\
**Last updated:** [July 30, 2026, 2:58pm UTC](https://ziggit.dev/t/is-there-a-git-tag-naming-convention-or-requirement-for-zig-libraries/16990 "2026-07-30T14:58:54Z")

</div>

For example, in Go modules are required to have a specific version tag format (v1.2.3). Is there such a requirement in Zig? If I’m creating a library should I create git tags like v1.2.3 or is just 1.2.3 ok? If there i…

---

## [When should I \`io\` be passed in vs stored?](https://ziggit.dev/t/when-should-i-io-be-passed-in-vs-stored/16962)

<div class="topic-metadata">

**Author:** [@giluis](https://ziggit.dev/u/giluis)\
**Replies:** 15\
**Last updated:** [July 29, 2026, 9:58am UTC](https://ziggit.dev/t/when-should-i-io-be-passed-in-vs-stored/16962 "2026-07-29T09:58:29Z")

</div>

In his Don’t forget to flush talk, Andrew mentions one of the advantages of having an io instance passed as an argument is that function purity becomes apparent. I love that. However, sometimes standard library types st…

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

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