Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Increment and Decrement Operators

 
Saumya Tangeda
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I read about the rules for unary and binary numeric promotion.
Unary numeric promotion is valid for operators:+,-,~,[],<<,>>>,>>
Binary numeric promotion is valid for: -relational operators
-bitwise operators
- == and !=
-arithmetic operators
Does the type promotion occur for ++ and - - operators?What type?Unary or Binary?
 
Edwin Dalorzo
Ranch Hand
Posts: 961
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, it happens. Promotion and autocasting.

For instance:



This is equal to:



The ++ and -- operators act on a single operand, therefore the answer to your questions regarding if this is a binary or unary numeric promotion is evident.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic