3 ms·
Future programming languages could have (IIRC some current PLs allow for such syntax, some of them I believe using 'let'): if (p_non_null = (p != NULL)) &&
by rajnathani 4y ago
Future programming languages could have (IIRC some current PLs allow for such syntax, some of them I believe using 'let'):
if (p_non_null = (p != NULL)) && (char_non_space = (*p != ' ')) { ... }
But where the IDE only shows the LHS of the expression as:
if p_non_null && char_ non_space { ... }
But also where the IDE makes it easier to write the earlier full expression above.
Also, the initial code:
bool p_non_null = (p != NULL);
bool char_non_space = (*p != ' ');
if p_non_null && char_ non_space { ... }
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.