Hacker News new | ask | show | jobs
by uecker 37 days ago
Oh, you can get the information at compile time as well. https://godbolt.org/z/hTYbTE8j8 (or https://godbolt.org/z/K1M68sY3Y but this will be tricky in a larger code base)
1 comments

That's the reason language/compiler should directly support optionality.

You can't fool yourself and have to handle all cases: https://godbolt.org/z/4GqMdPej3

So it seems exactly the same to me?
Nice one. gcc/clang are smart enough to get .ok condition statically. I'm very curios how complex an expression could be.