You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
afaik this is more or less expected and allowed. comparing to undefined is only an error and considered UB when branching on it e.g. if (foo == undefined). simply observing the value is fine but the result isnt something to be relied on
Not a bug; runtime safety for branching on undefined (which std.fmt ultimately does, making this example UB) is #63. (That said, std.fmtcould be improved to emit a compile error when passed a comptime-known undefined, as it is in this case.)
This fell out of an assert(), actually. The fmt was simply how I tracked it down. The assert(foo != undefined) passed on Linux but failed on Windows.
You're not supposed to compare against undefined. That assert is undefined behaviour, as it's branching on undefined. undefined has no set value, and it does not make sense to compare against it anyway.
Zig Version
0.14.0-dev.2126+e27b4647d
Steps to Reproduce and Observed Behavior
I have the following code:
foo is a VkFence returned from vkCreateFence in Vulkan.
On Windows I get "false false" on Linux I got "true true".
Expected Behavior
I guess, runtime crash? We're clearly not supposed to be using "undefined" in runtime checks anymore.
The text was updated successfully, but these errors were encountered: