Created
January 21, 2013 20:49
-
-
Save acmorrow/4589211 to your computer and use it in GitHub Desktop.
error_or: return codes example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Error handling with return codes | |
Status makeAFoo(Foo** result, int param1, int param2); | |
Foo* newFoo = NULL; | |
Status s = makeAFoo(&result, 42, 0); | |
if (s) { | |
// use newFoo | |
} else { | |
// handle error | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment