Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site oscvax.UUCP Path: utzoo!utcs!oscvax!alan From: alan@oscvax.UUCP (Alan Rooks) Newsgroups: net.lang.c Subject: Proposal for new operator :-) Message-ID: <380@oscvax.UUCP> Date: Fri, 27-Sep-85 16:10:39 EDT Article-I.D.: oscvax.380 Posted: Fri Sep 27 16:10:39 1985 Date-Received: Fri, 27-Sep-85 20:19:12 EDT Reply-To: alan@oscvax.UUCP (Alan Rooks) Organization: Ontario Science Centre, Toronto Lines: 54 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.