Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utcs!mnetor!seismo!caip!cbmvax!daveh From: daveh@cbmvax.UUCP Newsgroups: net.lang.c Subject: Re: Re: Re: Precedent for use of = Message-ID: <514@cbmvax.cbmvax.cbm.UUCP> Date: Fri, 11-Jul-86 11:48:09 EDT Article-I.D.: cbmvax.514 Posted: Fri Jul 11 11:48:09 1986 Date-Received: Fri, 11-Jul-86 23:02:57 EDT References: <2323@umcp-cs.UUCP> Organization: Commodore Technology, West Chester, PA Lines: 52 > > Unfortunately, it's that kind of attitude that leads to the perpetuation of > bad language constructs. > > C's handling of assignment and equality is a problem: it is error-prone. > What's worse is that one often sees code like "if (a=b)" done on purpose-- > yet another example on how the "power and terseness" of C leads to > obfuscation. > > C. Wingate Hey, you can use assignment in C as if it were a statement only when you write YOUR C code, but in the example that you give its used in its full power as an operator, which can generate much more efficient code than the equivalent: a=b if (b) Personally, I would have coded it if ((a=b) == 0) OR if ((a=b) == NULL) to make my point clear (a good compiler will produce the same code in all three cases, though a bad one may code more efficiently on the first example). But my point is that there's nothing inherently bad about the constructs available in C, there's no confusion if you know the language and don't specifically try to write confusing code (which you can do in languages like APL and LISP much more effectively than in C), and there's additional power in the language for those who know how to use it. You like the verobsity of Pascal, so use Pascal. I like the power of C, which is why I write in it, and I'm not confusing MYSELF with C. Giving Pascal's rules to a good C programmer is like giving a dull scapel to a skilled surgeon; he can't cut himself with it. -- /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ Dave Haynie {caip,ihnp4,allegra,seismo}!cbmvax!daveh "I don't feel safe in this world no more, I don't want to die in a nuclear war, I want to sail away to a distant shore And live like an ape man." -The Kinks These opinions are my own, though for a small fee they be yours too. \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/