Y
Hacker News
new
|
ask
|
show
|
jobs
by
orphea
206 days ago
Like goto, unwrap is just a tool that has its use cases. No need to make a boogeyman out of it.
3 comments
gishh
206 days 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.
link
tucnak
205 days ago
Nonsense. Linux kernel for one example, uses goto everywhere for error handling.
link
gishh
201 days ago
How many codebases besides the Linux kernel had you seen an intentional amount of use of goto?
link
orphea
199 days ago
The answer is one search away on GitHub.
I will give you one example though: various .NET repositories (runtime, aspnetcore, orleans).
link
metaltyphoon
206 days 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.
link
fwjafwasd
206 days ago
panicans should be using .expect() in production
link