Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on Named Booleans prevent C++ bugs and save you time. Parent comment
if (p_non_null = (p != NULL)) && (char_non_space = (*p != ' ')) { ... }
if p_non_null && char_ non_space { ... }
Also, the initial code:
bool p_non_null = (p != NULL); bool char_non_space = (*p != ' '); if p_non_null && char_ non_space { ... }
There are no comments on this comment yet.
Also, the initial code:
This could simply be analyzed by the compiler to not store the named boolean variables in the first place, and to evaluate them inline in the if-condition so as to allow for the short-circuiting to occur fine.