mirror of
https://github.com/ziglang/zig.git
synced 2024-11-28 08:02:32 +00:00
c93e0d8618
* There was an edge case where the arena could be destroyed twice on error: once from the arena itself and once from the decl destruction. * The type of the created decl was incorrect (it should have been the pointer child type), but it's not required anyway, so it's now just initialized to anyopaque (which more accurately reflects what's actually at that memory, since e.g. [*]T may correspond to nothing). * A runtime bitcast of the pointer was performed, meaning @extern didn't work at comptime. This is unnecessary: the decl_ref can just be initialized with the correct pointer type.
13 lines
242 B
Zig
13 lines
242 B
Zig
var hidden: u32 = 0;
|
|
export fn updateHidden(val: u32) void {
|
|
hidden = val;
|
|
}
|
|
export fn getHidden() u32 {
|
|
return hidden;
|
|
}
|
|
|
|
const T = extern struct { x: u32 };
|
|
|
|
export var mut_val: f64 = 1.23;
|
|
export const const_val: T = .{ .x = 42 };
|