RSSAmplifier

openmymind.net · Jan 3, 2025

Zig's @bitCast

0
Sign in to vote or save

This site does not allow itself to be embedded. You can still read it on the original site — the toolbar below keeps your place in the directory.

In an older post, we explored Zig's @ptrCast and then looked at a concrete usage in the shape of std.heap.MemoryPool . @ptrCast As a brief recap, when we use @ptrCast , we're telling the compiler to treat a pointer as a given type. For example, this code runs fine: const std = @import("std"); pub fn main() !void { var user = User{.power = 9001, .name = "Goku", .active = true}; const cat: *Cat =…

Read on openmymind.net

Comments

Nothing yet. Say the first thing.

    Sign in to join the conversation.