In the following case,
int i = 0;
int j = 42;
i = j++;
I know ++ is posfix operator, So, is j a posfix expression or should you sayj++ is posfix expression ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Syntactically, both
jandj++are postfix-expressions.See the grammar in section 5.2 of the C++ 2003 standard:
(
jis also a primary-expression;j++is not.)The fact that a primary-expression is a kind of postfix-expression (even if it doesn’t contain a postfix operator) is mostly a matter of convenience for defining the language syntax. There’s not much point in referring to
jas a postfix-expression unless you’re talking about parsing C++ (or C) source code.