Y
Hacker News
new
|
ask
|
show
|
jobs
by
WalterBright
2962 days ago
Rather than debate, here's an example of replacing goto's with a nested function:
https://github.com/dlang/dmd/pull/6656/files
1 comments
vardump
2962 days ago
I guess it's a matter of taste, but I often (not always) prefer less return statements in a function with gotos to error handling/cleanup code. Especially in kernel mode drivers.
link
WalterBright
2962 days ago
Check the asm code generated by your compiler - it may optimize multiple returns into one.
link
vardump
2962 days ago
Not performance or code size I'm concerned, it's mainly about correctness. Stuff like input validation and releasing a spinlock in kernel code.
link