#Unwrapping Optional with --release=fast

1 messages · Page 1 of 1 (latest)

vast mesa
#

If I try to unwrap an optional that is is null with --release=fast, my program doesn't crash. So what happens in my code with this happens? Is this just UB?

gentle venture
#

It is UB, or the term zig prefers is Illegal behaviour. zig attempts to define it better and distinguishes between checked an uncheccked IB.

#

.? is you saying 'this shouldnt be null at this point'. If it can be null then you should instead be using if or orelse.

tribal seal
#

another way to think about it is,
.? is semantically identical to orelse unreachable
if its null, you reach an unreachable