Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utcs!mnetor!seismo!brl-adm!brl-smoke!smoke!mangoe@mimsy.umd.edu From: mangoe@mimsy.umd.edu Newsgroups: net.lang.c Subject: Re: Re: Precedent for use of = Message-ID: <2239@brl-smoke.ARPA> Date: Tue, 15-Jul-86 02:31:21 EDT Article-I.D.: brl-smok.2239 Posted: Tue Jul 15 02:31:21 1986 Date-Received: Tue, 15-Jul-86 23:18:17 EDT Sender: news@brl-smoke.ARPA Lines: 26 The reasons all really boil down to optimization. The only reason I can see to prefer (a=b) over ((a=b)!=NULL) (why did C have to perpetuate the PL/I mistake on the not-equals operator, anyway?) is efficiency, and this isn't exactly a difficult optimization to do mechanically. I can see that it is useful for some applications to be able to write in what is essentially a high level language containing an assembler, but I don't for a minute believ that it is a virtue. I also don't believe that the C method is the only way to have assignments in expressions and still keep "=" for both purposes. One of PL/I's few virtues is that it recognizes that equality and assignments are both reasonably common, but that assignments in expressions are relatively rare. So it has a special "assignment-with-value" operator. If it is insisted that there is a separate boolean type, then most of the errors in this sort of system can be flagged and corrected. I've been looking at 4.3 code, particularly for the Sun. There are plenty of places where pointers are used indifferently as pointers to structures and as pointers to arrays. There is code which relies on ints and pointers being the same size. There is code which relies on successive declarations being stored contiguously and in order. Code which relies on NULL equalling zero is omnipresent. All this leads me inescapably to the conclusion that C was designed to allow programmers to violate the rules which everyone else is busily putting into their languages to protect themselves. I have to use C, but I'm not at all happy with what itclaims as features. CGW