3 ms·
Well to each its own, or however the saying goes. Because strcmp() returns a difference, as you said, i.e. a number comparing it a number "== 0" makes most sens
by rdtsc 10y ago
Well to each its own, or however the saying goes. Because strcmp() returns a difference, as you said, i.e. a number comparing it a number "== 0" makes most sense to me.
> "not" means "no difference
I'd rather see less "not"s, it is easier to reason about. "not" means logical expressions to me, strcmp returns numbers, I would rather keep ! away.
> "if(!p)" means "there is no (object pointed to by) p".
Ok, now we have pointer in play. strcmp really does return numbers. Why bring pointers or logic operators, doesn't that confuse things? It does for me.
> ((strcmp(a, b) == 0) != false)
I have never seen that. And would never advocate for that, why are we doing it that way again?
- lfowles 10y ago>> ((strcmp(a, b) == 0) != false) >I have never seen that. And would never advocate for that, why are we doing it that way again? I think a more reasonable example would be (with some reasonably namespaced define, blah blah blah): strcmp(a, b) == CMP_EQUAL;