Y
Hacker News
new
|
ask
|
show
|
jobs
by
djoldman
1868 days ago
Quick question: all the goto fail's where
fail: return false;
This is just to perhaps change return false to something else in the future, correct? Else why not just return false everywhere instead of goto fail
3 comments
alksjdalkj
1868 days ago
Not sure if this is the author's reason but I find it helpful to have a single return point from functions. Much easier to follow code paths.
You'll see this in some places in Linux's source too.
link
namdnay
1868 days ago
I think it’s to cleanly show when he is using his pseudo-exception handling system. So goto fail would be “throw”
link
slim
1868 days ago
Not op, but that's obviously in case you need to do something more complicated than returning false later. It's good practice
link
You'll see this in some places in Linux's source too.