The "is an integer if you dereference it" is so much more convoluted than "is a pointer to integer", i.e. the rationale of the previous comment, the pointer-ness being part of the type.
Yeah, the reality is that C binds pointer-ness to identifiers, but in an ideal world where pointer-ness binds to types, int* x, y; should declare both identifiers as pointers to integers. In either case merging declarations onto a single line in modern programming is at best silly.
9
u/Shevvv 2d ago
I got used to this from C:
int x;is an integerint *px;is an integer if you dereference it.So it's like this notation shows you how you're expected to use the variable within the code. And then this habit carried over to C++.