If there is a set of bool functions, then sometimes below trick may be used to make the code that checks those values shorter:
bool status = true; status &= foo_1(); status &= foo_2(); status &= foo_1(); printf(status ? "status: OK\n" : "status: NOK\n");
Interesting, but in most of the real code you shouldn't execute (above) second and third method if the first failed. In addition, it's creepy and obscure ;)
ReplyDelete100% agree :)
Delete