Changes between Version 23 and Version 24 of Hacking


Ignore:
Timestamp:
06/12/15 18:26:37 (9 years ago)
Author:
andrew_b
Comment:

Explicit comparison in equality operators

Legend:

Unmodified
Added
Removed
Modified
  • Hacking

    v23 v24  
    193193}}} 
    194194 
     195Use explicit comparison in equality operators: 
     196 
     197'''This is right:''' 
     198{{{ 
     199void *p1, *p2; 
     200int i1, i2; 
     201char c1, c2; 
     202 
     203if (p1 != NULL) 
     204if (p2 == NULL) 
     205 
     206if (i1 != 0) 
     207if (i2 == 0) 
     208 
     209if (c1 != '\0') 
     210if (c2 == '\0') 
     211}}} 
     212 
     213'''This is wrong:''' 
     214{{{ 
     215void *p1, *p2; 
     216int i1, i2; 
     217char c1, c2; 
     218 
     219if (p1) 
     220if (!p2) 
     221 
     222if (i1) 
     223if (!i2) 
     224 
     225if (c1) 
     226if (!c2) 
     227}}} 
     228 
    195229=== Variables === 
    196230