[891] in java-interest
Re: Operator precedence
daemon@ATHENA.MIT.EDU (Paul Phillips)
Mon Aug 14 03:43:44 1995
Date: Sun, 13 Aug 1995 21:01:52 -0700 (PDT)
From: Paul Phillips <paulp@CERF.NET>
To: java-interest@java.sun.com
cc: Scott Hudson <hudson@cc.gatech.edu>
In-Reply-To: <199508140320.XAA29295@cobb.cc.gatech.edu>
On Sun, 13 Aug 1995, Scott Hudson wrote:
> Could you be more specific about what you think is wrong with the C levels?
> Could be I'm just used to them, but they seem to me fairly well thought out.
> For example, if you start removing levels, will "x = a < b && c < d || e < f"
> do what you would expect (it doesn't for example in Pascal).
The most well-known example is probably that bitwise & and | have lower
precedence than ==, which means code like (a & b == c) does not do what
would be sensible. This came about because C originally used & and | for
both bitwise and logical and/or, and when the && and || operators were
added, they didn't want to break exisiting code that made assumptions
about precedence.
I'm no language guru, but I expect someone that has spent more time
around C than I can point out a couple other flaws. I'm not necessarily
advocating any change, as it would probably freak out C programmers no end,
but I was curious whether it was ever on the table to change it.
--
Paul Phillips | "Click _here_ if you do not
<URL:mailto:paulp@cerf.net> | have a graphical browser"
<URL:http://www.primus.com/staff/paulp/> | -- Canter and Siegel, on
<URL:pots://+1-619-220-0850/is/paul/there?> | their short-lived web site
-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com