alan@oscvax.UUCP (Alan Rooks) (09/27/85)
It seems, from all of the talk of boolean types, and programming-in-the- abstract, that C is being used for more and more abstract, quiche-eating, pascal-ish stuff. The language was obviously not intended to have a boolean type, otherwise Ritchie would have included bool as a primitive type. Anyways, if C must have bools, then i propose a new operator, analogous to the ++ and -- operators, to be used for a very common *boolean* operation. The !! operator. if (!!flag) { /* done if flag was false, but now it's true */ } else { /* done if flag was true, now it's false */ } if (flag!!) { /* done if flag was true, now it's false */ } else { /* done if flag was false, but now it's true */ } Or to initialize the squares of a chess board: isblack = TRUE; for (i = 0; i < 8; i++) for (j = 0; j < 8; j++) board[i][j].colour = isblack!!; This makes the "english" interpretation of the code very interesting: if (machine_is_on_fire!!) put_it_out(); else machine_is_on_fire!!; /* now machine_is_on_fire == FALSE */ Shall i submit this to mod.std.c ????? Alan Rooks ...!utzoo!oscvax!alan P.S. Please do not start up the ^^ and ->= discussions again.