3 ms·
There's the 5th method that I tend to use: if (!init_stuff(bar)) { return FALSE; } if (!do_the_thing(bar)) { return FALSE; } return TRU
by Rygu 14y ago
There's the 5th method that I tend to use:
if (!init_stuff(bar)) {
return FALSE;
}
if (!do_the_thing(bar)) {
return FALSE;
}
return TRUE;
- DanielShir 14y agoI do the same thing with my code, but I think it clutters it up and it's hard to follow the logic this way with clean up code all over the place.
- borlak 14y agothis is correct and why the original post is all wrong. what is calling foo()? it should be making sure foo() is happy, and if not, then continue your logic from there. that is how you handle errors in C.