Path: utzoo!utgpu!water!watmath!clyde!cbosgd!ihnp4!ihlpf!nevin1 From: nevin1@ihlpf.ATT.COM (00704A-Liber) Newsgroups: comp.lang.c Subject: Re: priorities of = and == revisited Message-ID: <3486@ihlpf.ATT.COM> Date: 23 Jan 88 02:09:29 GMT References: <1175@ark.cs.vu.nl> Reply-To: nevin1@ihlpf.UUCP (00704A-Liber,N.) Organization: AT&T Bell Laboratories - Naperville, Illinois Lines: 23 In article <1175@ark.cs.vu.nl> maart@cs.vu.nl (Maarten Litmaath) writes: >Allright, maybe I was a bit hasty in putting aside the 'backward compatibility' >argument. Further, it's generally good to give assignment low priority, I >guess. But on the other hand, as Tom Truscott mentioned, "C converted from >x =OP y to x OP= y without too much hassle", so why not enhancing the >language further ? This would not be an enhancement! The reason that x =OP y was changed to x OP= y was to avoid ambiguous statements in C. Example: Does x=*y mean 'assign what y points to to x' or does it mean 'multiply x by y and assign it to x'? (I don't think whitespace is required between operators.) One of the reasons that the precedence of assignment is put low is because the operators above it all produce results which can be assigned to a var. (If you put assignment above bitwise or, for example, x = a | b would mean (x = a) | b instead of x = (a | b).) This leads to consistency in use, which most people would agree makes it easier to remember and hence easier to use (though in some circumstances more verbose). -- _ __ NEVIN J. LIBER ..!ihnp4!ihlpf!nevin1 (312) 510-6194 ' ) ) "The secret compartment of my ring I fill / / _ , __o ____ with an Underdog super-energy pill." / (_