- this example uses a reference implementation from sph-sc-lib
- status_declare declares a local variable
status_t status = {0, ""};
, the other status_*
bindings use that variable - status_require checks that status.id is status_id_success, which is zero, and goes to exit if not
#include "sph/status.c"
status_t test() {
status_declare;
if (1 < 2) {
status_set_goto("mylib", 456);
}
exit:
return status;
}
int main() {
status_init;
// code ...
status_require(test());
// more code ...
exit:
return status.id;
}