3 ms·
I thought that only makes sense in JS. In C any nonzero value is considered "truthy", and on most architectures NULL is defined to be (void * )(0) or similar.
by nitrogen 6y ago
I thought that only makes sense in JS.
In C any nonzero value is considered "truthy", and on most architectures NULL is defined to be (void * )(0) or similar. The logical not operator AKA bang operator will replace truthiness with 0, and falsiness with 1. So applying it twice collapses all nonzero values to 1.
- user-the-name 6y agoWell, yes, but that does absolutely nothing in this code, as it is immediately used as the argument to an if statement.
- nitrogen 6y agoIndeed, I was only commenting on the JS vs C part.