hi all, I have the following line in my code: PortVal << 1; When I compile using c51 v6.12, I get the following warning assocaiated with that line: "warning C275: expression with possibly no effect" When I load this into my emulator, "PortVal << 1" has been optimized away. I know that << 1 is the same as *2, and when I use *2, the compilier is happy, but I like << 1 because it helps readability..... Does anyone know why << 1 causes that warning or how to prevent it from being optimized away? Thanks Steve
PortVal <<= did the trick! I looked in K&R and they dont show <<=. It just shows val << 1. Anyway..... Yes, that fixed it. Thanks, Steve
The <<= operator is listed in K&R. You just have to read the section on Assignment Operators and Expressions (section 2.10) very carefully. "...Most binary operators...have a corresponding assignment operator op=, where op is one of + - * / % << >> & ^ | ..." Jon