int* p1, p2;
According to the C++ standard, p1
is a pointer yet p2
is not.
I just wonder why the C++ standard doesn't also define p2
as a pointer?
I think it is reasonable to do so. Because:
C++ is a strong-typing language. That is to say, given any type T, the statement T t1, t2;
always guarantees t1
and t2
have the same type.
However, the fact that p1
and p2
don't have the same type breaks the rule, and seems counter-intuitive.
So, my question is: What's the rationale to make such a counter-intuitive rule as is? Just for backward compatibility?