#var r: T = undefined, then setting fields anyways in std.json

1 messages · Page 1 of 1 (latest)

dire edge
#

https://github.com/ziglang/zig/blob/master/lib/std/json/static.zig#L336

I'm trying to understand the ownership of json parsing, and in reading the code im puzzled by how like 336 declares r as undefined, then line 370 sets a field on r (where its type is a struct) even though r seemingly has never been initialized or had memory allocated for it.

GitHub

General-purpose programming language and toolchain for maintaining robust, optimal, and reusable software. - ziglang/zig

merry gale
#

r is a variable on the stack, undefined means dont initialize iit but it always exists