On 29/03/2012 00:52, mathog wrote:
On 28-Mar-2012 15:20, Michael Witten wrote:

However, it seems to me that toggling the value with the idiom:

--b;

is aesthetically preferable to the more elaborate:

b = !b;

Aesthetically, not logically. Neither of these makes the least bit of
sense:

one less than False
one less than True

A better solution for the aesthetics would have been (it is a bit late
now) to implement the missing unary negation operator:

!!b; //T->F, F->T


You can't do that, because "!!" is already a useful operator on integers - it turns anything non-zero into 1 while leaving 0 alone, and is effectively an "int to bool" conversion operator.

That operator would save even more program characters for the other int
types, where it would be equivalent to:

(i==0 ? 1 : 0);


Regards,

David Mathog
mat...@caltech.edu
Manager, Sequence Analysis Facility, Biology Division, Caltech


Reply via email to