The tag has no wiki summary.

learn more… | top users | synonyms

1
vote
2answers
306 views

Should ** bind more tightly than !, ~?

Designing a programming language, I'm including the ** exponentiation operator. In Fortran and Python, the two languages I know of which have this operator, it binds more tightly than unary minus, ...
0
votes
1answer
80 views

Undefined behaviour or precedence question [duplicate]

The following code snippet in C: i=i++; has undefined behaviour according to a book.But my logic is this: Since ++ operator has more precedence than = operator,it should be evaluated first,so i++ ...
58
votes
15answers
5k views

Should I use parentheses in logical statements even where not necessary?

Let's say I have a boolean condition a AND b OR c AND d and I'm using a language where AND has a higher order of operation precedent than OR. I could write this line of code: If (a AND b) OR (c AND ...
2
votes
1answer
120 views

Evaluation order of the expressions

The C Programming Language by K & R states that C, like most languages, does not specify the order in which operands of an operator are evaluated. (The exceptions are &&,||,?: and ','). ...
35
votes
2answers
2k views

Why do bitwise operators have lower priority than comparisons?

Could someone explain the rationale, why in a bunch of most popular languages (see note below) comparison operators (==, !=, <, >, <=, >=) have higher priority than bitwise operators (&, |, ...