Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rule 19.4 Does "#define XY -1" violate 19.4
#2
I'm not surprised it's rejected. "-1" isn't an integer literal, it's the unary minus operator applied to a literal. This means that it's an expression and should be parenthesised.

I can't think of any cases where using it gives a surprisingly wrong answer, but it does allow things to compile that look wrong, such as:-
Code:
    int b = 3 XY;

Simon
<t></t>
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)