Efficient coding considered harmful?
    Guy Harris 
    guy at auspex.UUCP
       
    Sat Oct 29 02:15:39 AEST 1988
    
    
  
>:     o   Use the ^ operator because many times,
>:                 a = !a;
>:         should really be,
>:                 a ^= 1;
>
>However, some machines can't do ^ very well, so take care.
And some code for reasons of, well, *microefficiency* may rely on the
fact that any non-zero value, not just 1, is considered "true" by C; the
only safe way of inverting such a boolean is with "a = !a". 
Too bad C doesn't have a Boolean type....
    
    
More information about the Comp.lang.c
mailing list