# Challenge

**URL:** https://ziggit.dev/c/challenge/11.md?page=1

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

**Page:** 2

---

## [Creating Cross Platform Plugin System](https://ziggit.dev/t/creating-cross-platform-plugin-system/8099)

<div class="topic-metadata">

**Author:** [@CypherpunkSamurai](https://ziggit.dev/u/CypherpunkSamurai)\
**Replies:** 4\
**Last updated:** [January 24, 2025, 9:34am UTC](https://ziggit.dev/t/creating-cross-platform-plugin-system/8099 "2025-01-24T09:34:37Z")

</div>

Hello Zig community, Note: Before you read the post I want you to please excuse my knowledge on zig, compilers and shared libraries. I know I’m not great and im happy to learn a lot from you all :smiley: Ever since I…

---

## [AoC 2024: Day 25 (Christmas)](https://ziggit.dev/t/aoc-2024-day-25-christmas/7497)

<div class="topic-metadata">

**Author:** [@Calder-Ty](https://ziggit.dev/u/Calder-Ty)\
**Replies:** 2\
**Last updated:** [December 28, 2024, 2:27am UTC](https://ziggit.dev/t/aoc-2024-day-25-christmas/7497 "2024-12-28T02:27:46Z")

</div>

Merry Christmas! It’s been fun to see the different solutions. Thanks for participating this year. Main thread for Day 25 of the 2024 advent of code. Feel free to discuss the challenge and ask questions. If particular d…

---

## [AoC 2024: Day 23](https://ziggit.dev/t/aoc-2024-day-23/7483)

<div class="topic-metadata">

**Author:** [@Calder-Ty](https://ziggit.dev/u/Calder-Ty)\
**Replies:** 2\
**Last updated:** [December 27, 2024, 12:47am UTC](https://ziggit.dev/t/aoc-2024-day-23/7483 "2024-12-27T00:47:02Z")

</div>

Main thread for Day 23 of the 2024 advent of code. Feel free to discuss the challenge and ask questions. If particular discussions become large, we can break them off into new threads. Some Rules: Please try to keep s…

---

## [AoC 2024: Day 22](https://ziggit.dev/t/aoc-2024-day-22/7467)

<div class="topic-metadata">

**Author:** [@Calder-Ty](https://ziggit.dev/u/Calder-Ty)\
**Replies:** 2\
**Last updated:** [December 24, 2024, 10:05pm UTC](https://ziggit.dev/t/aoc-2024-day-22/7467 "2024-12-24T22:05:59Z")

</div>

Main thread for Day 22 of the 2024 advent of code. Feel free to discuss the challenge and ask questions. If particular discussions become large, we can break them off into new threads. Some Rules: Please try to keep s…

---

## [My journey in Zig: 2024](https://ziggit.dev/t/my-journey-in-zig-2024/7484)

<div class="topic-metadata">

**Author:** [@bongolin](https://ziggit.dev/u/bongolin)\
**Replies:** 2\
**Last updated:** [December 23, 2024, 9:48pm UTC](https://ziggit.dev/t/my-journey-in-zig-2024/7484 "2024-12-23T21:48:24Z")

</div>

Hello folks! It’s been a while since I posted my first post on this forum. A lot has changed in my life since then, and I ended up not being able to focus on learning Zig in 2024. This post is just a shoutout to anyone…

---

## [AoC 2024: Day 20](https://ziggit.dev/t/aoc-2024-day-20/7430)

<div class="topic-metadata">

**Author:** [@Calder-Ty](https://ziggit.dev/u/Calder-Ty)\
**Replies:** 3\
**Last updated:** [December 22, 2024, 11:19pm UTC](https://ziggit.dev/t/aoc-2024-day-20/7430 "2024-12-22T23:19:19Z")

</div>

Main thread for Day 20 of the 2024 advent of code. Feel free to discuss the challenge and ask questions. If particular discussions become large, we can break them off into new threads. Some Rules: Please try to keep s…

---

## [AoC 2024: Day 19](https://ziggit.dev/t/aoc-2024-day-19/7418)

<div class="topic-metadata">

**Author:** [@Calder-Ty](https://ziggit.dev/u/Calder-Ty)\
**Replies:** 4\
**Last updated:** [December 22, 2024, 6:16pm UTC](https://ziggit.dev/t/aoc-2024-day-19/7418 "2024-12-22T18:16:03Z")

</div>

Main thread for Day 19 of the 2024 advent of code. Feel free to discuss the challenge and ask questions. If particular discussions become large, we can break them off into new threads. Some Rules: Please try to keep s…

---

## [AoC 2024: Day 17](https://ziggit.dev/t/aoc-2024-day-17/7394)

<div class="topic-metadata">

**Author:** [@Calder-Ty](https://ziggit.dev/u/Calder-Ty)\
**Replies:** 3\
**Last updated:** [December 20, 2024, 8:02pm UTC](https://ziggit.dev/t/aoc-2024-day-17/7394 "2024-12-20T20:02:47Z")

</div>

Main thread for Day 17 of the 2024 advent of code. Feel free to discuss the challenge and ask questions. If particular discussions become large, we can break them off into new threads. Some Rules: Please try to keep s…

---

## [AoC 2024: Day 16](https://ziggit.dev/t/aoc-2024-day-16/7364)

<div class="topic-metadata">

**Author:** [@Calder-Ty](https://ziggit.dev/u/Calder-Ty)\
**Replies:** 5\
**Last updated:** [December 20, 2024, 5:51pm UTC](https://ziggit.dev/t/aoc-2024-day-16/7364 "2024-12-20T17:51:58Z")

</div>

Main thread for Day 16 of the 2024 advent of code. Feel free to discuss the challenge and ask questions. If particular discussions become large, we can break them off into new threads. Some Rules: Please try to keep s…

---

## [AoC 2024: Day 18](https://ziggit.dev/t/aoc-2024-day-18/7403)

<div class="topic-metadata">

**Author:** [@Calder-Ty](https://ziggit.dev/u/Calder-Ty)\
**Replies:** 3\
**Last updated:** [December 20, 2024, 2:37am UTC](https://ziggit.dev/t/aoc-2024-day-18/7403 "2024-12-20T02:37:39Z")

</div>

Main thread for Day 18 of the 2024 advent of code. Feel free to discuss the challenge and ask questions. If particular discussions become large, we can break them off into new threads. Some Rules: Please try to keep s…

---

## [AoC 2024: Day 15](https://ziggit.dev/t/aoc-2024-day-15/7342)

<div class="topic-metadata">

**Author:** [@Calder-Ty](https://ziggit.dev/u/Calder-Ty)\
**Replies:** 4\
**Last updated:** [December 17, 2024, 9:15am UTC](https://ziggit.dev/t/aoc-2024-day-15/7342 "2024-12-17T09:15:58Z")

</div>

Main thread for Day 15 of the 2024 advent of code. Feel free to discuss the challenge and ask questions. If particular discussions become large, we can break them off into new threads. Some Rules: Please try to keep s…

---

## [Using thread pool in WebAssembly](https://ziggit.dev/t/using-thread-pool-in-webassembly/7332)

<div class="topic-metadata">

**Author:** [@chung-leong](https://ziggit.dev/u/chung-leong)\
**Replies:** 5\
**Last updated:** [December 17, 2024, 6:52am UTC](https://ziggit.dev/t/using-thread-pool-in-webassembly/7332 "2024-12-17T06:52:47Z")

</div>

I’m working on a code example involving the use of std.Thread.Pool. The web browser is one of the target platforms. It’s problematic there because synchronous wait is not allowed in the main thread. std.Thread.Pool.spawn…

---

## [AoC 2024: Day 2](https://ziggit.dev/t/aoc-2024-day-2/7119)

<div class="topic-metadata">

**Author:** [@Calder-Ty](https://ziggit.dev/u/Calder-Ty)\
**Replies:** 9\
**Last updated:** [December 13, 2024, 4:04am UTC](https://ziggit.dev/t/aoc-2024-day-2/7119 "2024-12-13T04:04:25Z")

</div>

Main thread for Day 2 of the 2024 advent of code. Feel free to discuss the challenge and ask questions. If particular discussions become large, we can break them off into new threads. Some Rules: Please try to keep sp…

---

## [AoC 2024: Day 7](https://ziggit.dev/t/aoc-2024-day-7/7196)

<div class="topic-metadata">

**Author:** [@Calder-Ty](https://ziggit.dev/u/Calder-Ty)\
**Replies:** 7\
**Last updated:** [December 8, 2024, 5:54pm UTC](https://ziggit.dev/t/aoc-2024-day-7/7196 "2024-12-08T17:54:55Z")

</div>

Main thread for Day 7 of the 2024 advent of code. Feel free to discuss the challenge and ask questions. If particular discussions become large, we can break them off into new threads. Some Rules: Please try to keep sp…

---

## [AoC 2024: Day 5](https://ziggit.dev/t/aoc-2024-day-5/7167)

<div class="topic-metadata">

**Author:** [@Calder-Ty](https://ziggit.dev/u/Calder-Ty)\
**Replies:** 11\
**Last updated:** [December 6, 2024, 10:25am UTC](https://ziggit.dev/t/aoc-2024-day-5/7167 "2024-12-06T10:25:46Z")

</div>

Main thread for Day 5 of the 2024 advent of code. Feel free to discuss the challenge and ask questions. If particular discussions become large, we can break them off into new threads. Some Rules: Please try to keep sp…

---

## [AoC 2024: Day 4](https://ziggit.dev/t/aoc-2024-day-4/7150)

<div class="topic-metadata">

**Author:** [@Calder-Ty](https://ziggit.dev/u/Calder-Ty)\
**Replies:** 13\
**Last updated:** [December 5, 2024, 2:03pm UTC](https://ziggit.dev/t/aoc-2024-day-4/7150 "2024-12-05T14:03:32Z")

</div>

Main thread for Day 4 of the 2024 advent of code. Feel free to discuss the challenge and ask questions. If particular discussions become large, we can break them off into new threads. Some Rules: Please try to keep sp…

---

## [AoC 2024: Day 1](https://ziggit.dev/t/aoc-2024-day-1/7100)

<div class="topic-metadata">

**Author:** [@Calder-Ty](https://ziggit.dev/u/Calder-Ty)\
**Replies:** 8\
**Last updated:** [December 5, 2024, 11:03am UTC](https://ziggit.dev/t/aoc-2024-day-1/7100 "2024-12-05T11:03:20Z")

</div>

Hey all, I’ve decided to add a singular “main” discussion thread for general discussion around Advent of Code. Feel free to discuss the challenges and ask questions. If particular discussions become large, we can break t…

---

## [AoC 2024: Day 3](https://ziggit.dev/t/aoc-2024-day-3/7136)

<div class="topic-metadata">

**Author:** [@Calder-Ty](https://ziggit.dev/u/Calder-Ty)\
**Replies:** 16\
**Last updated:** [December 4, 2024, 11:20am UTC](https://ziggit.dev/t/aoc-2024-day-3/7136 "2024-12-04T11:20:28Z")

</div>

Main thread for Day 3 of the 2024 advent of code. Feel free to discuss the challenge and ask questions. If particular discussions become large, we can break them off into new threads. Some Rules: Please try to keep sp…

---

## [C++ comptime, can we do this in Zig?](https://ziggit.dev/t/c-comptime-can-we-do-this-in-zig/5968)

<div class="topic-metadata">

**Author:** [@mocompute](https://ziggit.dev/u/mocompute)\
**Replies:** 2\
**Last updated:** [September 13, 2024, 1:42am UTC](https://ziggit.dev/t/c-comptime-can-we-do-this-in-zig/5968 "2024-09-13T01:42:16Z")

</div>

Many of us probably know about C++ template meta programming etc. They’ve been comptime programming over there for a few decades, and the language has been slowly improving to make this slightly less torturous by generat…

---

## [Why does this code lead to a 100MB wasm file?](https://ziggit.dev/t/why-does-this-code-lead-to-a-100mb-wasm-file/5681)

<div class="topic-metadata">

**Author:** [@chung-leong](https://ziggit.dev/u/chung-leong)\
**Replies:** 1\
**Last updated:** [August 18, 2024, 9:47pm UTC](https://ziggit.dev/t/why-does-this-code-lead-to-a-100mb-wasm-file/5681 "2024-08-18T21:47:30Z")

</div>

If you compile the following code: const std = @import("std"); const allocator: std.mem.Allocator = .{ .ptr = undefined, .vtable = &std.heap.WasmAllocator.vtable, }; var sfb = std.heap.stackFallback(1024 \* 1024…

---

## [Creating an instance of enum{}](https://ziggit.dev/t/creating-an-instance-of-enum/5680)

<div class="topic-metadata">

**Author:** [@chung-leong](https://ziggit.dev/u/chung-leong)\
**Replies:** 2\
**Last updated:** [August 18, 2024, 9:01pm UTC](https://ziggit.dev/t/creating-an-instance-of-enum/5680 "2024-08-18T21:01:15Z")

</div>

How do you make the following function compile? fn hello() enum {} { // ??? }

---

## [Comptime Interface testing](https://ziggit.dev/t/comptime-interface-testing/3958)

<div class="topic-metadata">

**Author:** [@nyc](https://ziggit.dev/u/nyc)\
**Replies:** 1\
**Last updated:** [August 12, 2024, 1:42am UTC](https://ziggit.dev/t/comptime-interface-testing/3958 "2024-08-12T01:42:43Z")

</div>

Here is a start of comptime code that will test a struct to see if it contains all the fields and delcs of another struct. I ideally you also want to extend this for unions, error sets, and all other types. Function par…

---

## [Kafkaesque Zig code](https://ziggit.dev/t/kafkaesque-zig-code/5046)

<div class="topic-metadata">

**Author:** [@chung-leong](https://ziggit.dev/u/chung-leong)\
**Replies:** 3\
**Last updated:** [July 9, 2024, 11:52am UTC](https://ziggit.dev/t/kafkaesque-zig-code/5046 "2024-07-09T11:52:27Z")

</div>

I was having trouble falling asleep so I dreamt up this nightmarish code sample: const std = @import("std"); pub fn main() void { var i: usize = 0; while (do: { break :do @typeInfo(@TypeOf(while (true) …

---

## [Programming Challenge: Confetti Animation](https://ziggit.dev/t/programming-challenge-confetti-animation/4290)

<div class="topic-metadata">

**Author:** [@marler8997](https://ziggit.dev/u/marler8997)\
**Replies:** 1\
**Last updated:** [May 12, 2024, 5:35pm UTC](https://ziggit.dev/t/programming-challenge-confetti-animation/4290 "2024-05-12T17:35:52Z")

</div>

I just finished implementing a confetti animation. It renders a thousand little images on the screen that are moving and spinning around in random looking directions (see attached image/video). The challenge is, w…

---

## [Generating unique id at comptime](https://ziggit.dev/t/generating-unique-id-at-comptime/3944)

<div class="topic-metadata">

**Author:** [@chung-leong](https://ziggit.dev/u/chung-leong)\
**Replies:** 1\
**Last updated:** [May 5, 2024, 9:25pm UTC](https://ziggit.dev/t/generating-unique-id-at-comptime/3944 "2024-05-05T21:25:06Z")

</div>

The following is some code I’ve been playing around with. The key function is getUniqueId, which returns a unique id for any given type: const std = @import("std"); const Error = error{failure\_is\_success}; fn fail(co…

---

## [Dealing with recursion in a comptime function](https://ziggit.dev/t/dealing-with-recursion-in-a-comptime-function/3930)

<div class="topic-metadata">

**Author:** [@chung-leong](https://ziggit.dev/u/chung-leong)\
**Replies:** 2\
**Last updated:** [April 12, 2024, 7:46pm UTC](https://ziggit.dev/t/dealing-with-recursion-in-a-comptime-function/3930 "2024-04-12T19:46:24Z")

</div>

This is actually a problem I’ve just encountered in my code. I think it’s interesting enough to warrant a post here. The isSupported function down below checks whether a data type is supported by my program. At the top …

---

## [Convert c struct with macro to zig](https://ziggit.dev/t/convert-c-struct-with-macro-to-zig/2966)

<div class="topic-metadata">

**Author:** [@jimying](https://ziggit.dev/u/jimying)\
**Replies:** 2\
**Last updated:** [January 23, 2024, 1:13am UTC](https://ziggit.dev/t/convert-c-struct-with-macro-to-zig/2966 "2024-01-23T01:13:18Z")

</div>

I know zig is not support macro. But in c language, often use macro in struct (eg.RFC protocol). I want to find a more zig-native way convert to zig. for sample: c code to define rtp header( rtp is an rfc protocol)…

---

## [Algorithm Translation Challenge 2: Partition](https://ziggit.dev/t/algorithm-translation-challenge-2-partition/2658)

<div class="topic-metadata">

**Author:** [@AndrewCodeDev](https://ziggit.dev/u/AndrewCodeDev)\
**Replies:** 3\
**Last updated:** [January 6, 2024, 5:44pm UTC](https://ziggit.dev/t/algorithm-translation-challenge-2-partition/2658 "2024-01-06T17:44:59Z")

</div>

Welcome to challenge two (and happy new years everyone)! Today, our target is partition - an algorithm that has a surprising number of uses. Partitions are useful concepts in algorithms such as quicksort but also have a…

---

## [Algorithm Translation Challenge 1: Symmetric Difference](https://ziggit.dev/t/algorithm-translation-challenge-1-symmetric-difference/2572)

<div class="topic-metadata">

**Author:** [@AndrewCodeDev](https://ziggit.dev/u/AndrewCodeDev)\
**Replies:** 4\
**Last updated:** [December 25, 2023, 7:06pm UTC](https://ziggit.dev/t/algorithm-translation-challenge-1-symmetric-difference/2572 "2023-12-25T19:06:15Z")

</div>

Hello everyone! I’m starting an algorithms series where we take famous algorithms written in other languages (I’m focusing on C/C++) and translate them to Zig code. Our target is Symmetric Difference - this algorithm po…

---

## [C/C++ macro challenge #3: omitting an argument](https://ziggit.dev/t/c-c-macro-challenge-3-omitting-an-argument/2371)

<div class="topic-metadata">

**Author:** [@chung-leong](https://ziggit.dev/u/chung-leong)\
**Replies:** 2\
**Last updated:** [December 10, 2023, 12:41am UTC](https://ziggit.dev/t/c-c-macro-challenge-3-omitting-an-argument/2371 "2023-12-10T00:41:25Z")

</div>

For this week’s challenge, we’ll be looking at macros from a couple decades ago. They’re from the source code of PHP 4, more specific its thread-safe resource management module. When PHP was compiled to operate in a mul…

[Previous page](https://ziggit.dev/c/challenge/11.md)

[Next page](https://ziggit.dev/c/challenge/11.md?page=2)
