Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
CptFox16197y<< has the lowest priority, and the rest is left to right, so I'd say 1<<5<<4 == 1<<9 == 256. But yeah, parenthesis would help. It would make sense that bitwise operation would had high priority, a left shift being a multiplication by a power of two, but fuck logic so no. Probably in order to force people to use parenthesis.
@rostopira nope, at least not in c nor java -
-
Having this comes in handy sometimes http://en.cppreference.com/w/cpp/...
But yeah, parenthesis > relying on precedence -
CptFox16197y@Krokoklemme that made me think, --a and -a have the same precedence, so is ---3 equal to -(--3)=-2 or --(-3)=-4 ?
When in doubt shroud your spout. Or just use parentheses!
1 << 2 + 3 << 4
rant