Skip to content
Better HN
Top
New
Best
Ask
Show
Jobs
Search
⌘K
undefined | Better HN
0 points
orphea
5mo ago
0 comments
Share
Like goto, unwrap is just a tool that has its use cases. No need to make a boogeyman out of it.
0 comments
default
newest
oldest
gishh
5mo ago
To be fair, if you’re not “this tall” you really shouldn’t consider using goto in a c program. Most people aren’t that tall.
tucnak
5mo ago
Nonsense. Linux kernel for one example, uses goto everywhere for error handling.
gishh
5mo ago
How many codebases besides the Linux kernel had you seen an intentional amount of use of goto?
orphea
OP
5mo ago
The answer is one search away on GitHub.
I will give you one example though: various .NET repositories (runtime, aspnetcore, orleans).
metaltyphoon
5mo ago
Yes it's meant to be used in test code. If you're sure it can't fail do then use .expect() that way it shows you made a choice and it wasn't just a dev oversight.
fwjafwasd
5mo ago
panicans should be using .expect() in production
j
/
k
navigate · click thread line to collapse