Post Reply 
Unary minus precedence preference
07-23-2014, 03:14 AM
Post: #10
RE: Unary minus precedence preference
Do you take -2^2 to mean: (-2)^2, -(2^2), or 0-(2^2)?

I've always taught that unary minus is the last (and should be parsed as if it was that by a computer), even though it's usually written as the second.

(I admit I came to this conclusion writing a compiler that emitted code for both one's and two's complement ALUs.)
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Unary minus precedence preference - htom trites - 07-23-2014 03:14 AM



User(s) browsing this thread: 1 Guest(s)