can anyone tell me what is the process of i+++ increment in c++.
相关问题
- Sorting 3 numbers without branching [closed]
- How to compile C++ code in GDB?
- Why does const allow implicit conversion of refere
- thread_local variables initialization
- What uses more memory in c++? An 2 ints or 2 funct
相关文章
- Class layout in C++: Why are members sometimes ord
- How to mock methods return object with deleted cop
- What does it means in C# : using -= operator by ev
- Which is the best way to multiply a large and spar
- C++ default constructor does not initialize pointe
- Selecting only the first few characters in a strin
- C# generics class operators not working
- What exactly do pointers store? (C++)
if you mean
i++
then its incrementing the value ofi
once its value has been read. As an example:i+++;
will not compile. There is no operator +++ in C++.i+++j
, on the other hand, will compile. It will add i and j and then increment i. Because it is parsed as(i++)+j
;It is a syntax error.
Using the maximum munching rule
i+++
is tokenized as:The last
+
is a binary addition operator. But clearly it does not have two operands which results in parser error.EDIT:
Question from the comment: Can we have
i++++j
?It is tokenized as:
which again is a syntax error as
++
is a unary operator.On similar lines
i+++++j
is tokenized by the scanner as:which is same as
((i++)++) + j
which again in error asi++
is not a lvalue and using++
on it is not allowed.