Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!think!harvard!seismo!brl-adm!brl-smoke!smoke!gwyn@BRL.ARPA From: gwyn@BRL.ARPA (VLD/VMB) Newsgroups: net.lang.c Subject: Re: Boolean Operators Slighted in C Message-ID: <727@brl-smoke.ARPA> Date: Fri, 9-May-86 16:52:37 EDT Article-I.D.: brl-smok.727 Posted: Fri May 9 16:52:37 1986 Date-Received: Sun, 25-May-86 06:28:28 EDT Sender: news@brl-smoke.ARPA Lines: 31 Steven Brian McKechnie Sargent says ("> ..."): > A Boolean data type distinct from integers clutters the language with > another (moderately useless) type and removes handy idioms like > foo[x == 0] = bar; Boolean quantities form an important abstract data type distinct from counters, sets, real numbers, etc. By not making the distinction, the language encourages usage errors, the most notorious being if ( a = b ) stuff; Sure, one can make integers do double (or triple, or ...) duty, but by now every programmer should realize the value of data abstraction. > New operators like "< =", in addition to being hard to spell and understand, > facilitate usages that just aren't that common. I hardly ever want to > say x = (x < y), and I don't mind typing the extra characters. I'm not > interested in paying compiler vendors money for supporting this (or any > other dubious misfeature pounded into the language for "completeness' > sake.") Here is an example where proper use of Boolean data would be violated. A statement like x = x < y; should NEVER be used, since it assigns a Boolean result to an arithmetic variable. This means that a "< =" operator is not a good idea. I find data abstraction to be a Good Thing, and have produced much better code since defining a Boolean data type and using it in a strictly type-correct manner.