Is there any opposition to relaxing this rule? Speak now or forever hold your piece! (not really but I would be curious to hear opposition).
Cheers, Keith > On Apr 27, 2017, at 10:32 PM, Carlos Garcia Campos <carlo...@webkit.org> > wrote: > > El jue, 27-04-2017 a las 16:06 -0700, JF Bastien escribió: >> Hello C++ fans! >> >> The C++ style check currently say: >> Tests for true/false, null/non-null, and zero/non-zero should all be >> done without equality comparisons >> >> I totally agree for booleans and pointers… but not for integers. I >> know it’s pretty much the same thing, but I it takes me slightly >> longer to process code like this: >> >> int numTestsForEqualityComparison = 0: >> // Count ‘em! >> // … >> if (!numTestsForEqualityComparison) >> printf(“Good job!”); >> >> I read it as “if not number of tests for equality comparison”. That's >> weird. It takes me every slightly longer to think about, and I’ve >> gotten it wrong a bunch of times already. I’m not trying to check for >> “notness", I’m trying to say “if there were zero tests for equality >> comparison”, a.k.a.: >> >> if (numTestsForEqualityComparison == 0) >> printf(“Good job!”); >> >> So how about the C++ style let me just say that? I’m not suggesting >> we advise using that style for integers everywhere, I’m just saying >> it should be acceptable to check zero/non-zero using equality >> comparison. > > I agree, it's also quite confusing when using strcmp, because !strcmp > means the strings are equal. It's not only more difficult to read, I've > seen patches with wrong strcmp checks because of that. I also think this could be solved by #defining a success a C call positive result that is 0 (e.g. CCallSuccess), regardless of the choice we make here. > >> >> !!Thanks (i.e. many thanks), >> >> JF >> >> p.s.: With you I am, fans of Yoda comparison, but for another day >> this will be. >> _______________________________________________ >> webkit-dev mailing list >> webkit-dev@lists.webkit.org <mailto:webkit-dev@lists.webkit.org> >> https://lists.webkit.org/mailman/listinfo/webkit-dev >> <https://lists.webkit.org/mailman/listinfo/webkit-dev> > _______________________________________________ > webkit-dev mailing list > webkit-dev@lists.webkit.org <mailto:webkit-dev@lists.webkit.org> > https://lists.webkit.org/mailman/listinfo/webkit-dev > <https://lists.webkit.org/mailman/listinfo/webkit-dev>
_______________________________________________ webkit-dev mailing list webkit-dev@lists.webkit.org https://lists.webkit.org/mailman/listinfo/webkit-dev