You are compiling in C++, not C.
The --
operator can only act on an object. In C, the --
operator produces only a value, not an lvalue. (An lvalue is an expression that may designate an object.) So the compiler will report that 0 <-------------------- x
has an error.
In C++, the --
operator produces an lvalue. So the compiler will allow 0 <-------------------- x
.
In both C and C++, the parsing is straightforward:
- In
<--------------------
, the longest sequence of characters (starting from the beginning) that constitutes a token is <
, so it is taken as a token and removed, leaving --------------------
.
- In
--------------------
, the longest sequence of characters (starting from the beginning) that constitutes a token is --
, so it is taken as a token and removed, leaving ------------------
.
- In
------------------
, the longest sequence of characters (starting from the beginning) that constitutes a token is --
, so it is taken as a token and removed, leaving ----------------
.
- In
----------------
, the longest sequence of characters (starting from the beginning) that constitutes a token is --
, so it is taken as a token and removed, leaving --------------
.
- In
--------------
, the longest sequence of characters (starting from the beginning) that constitutes a token is --
, so it is taken as a token and removed, leaving ------------
.
- In
------------
, the longest sequence of characters (starting from the beginning) that constitutes a token is --
, so it is taken as a token and removed, leaving ----------
.
- In
----------
, the longest sequence of characters (starting from the beginning) that constitutes a token is --
, so it is taken as a token and removed, leaving --------
.
- In
--------
, the longest sequence of characters (starting from the beginning) that constitutes a token is --
, so it is taken as a token and removed, leaving ------
.
- In
------
, the longest sequence of characters (starting from the beginning) that constitutes a token is --
, so it is taken as a token and removed, leaving ----
.
- In
----
, the longest sequence of characters (starting from the beginning) that constitutes a token is --
, so it is taken as a token and removed, leaving --
.
- In
--
, the longest sequence of characters (starting from the beginning) that constitutes a token is --
, so it is taken as a token and removed, after which the compiler goes on to further source text.
In both C and C++, the sequence of tokens is 0
<
--
--
--
--
--
--
--
--
--
--
x
. In C, this expression violates constraints. In C++, it does not.