4 ms·
although it's messed up anyway as But that's because they wanted it to be like that. To me, this code is very unclear: int a, *b, c, d; because everywhe
by dkersten 10y ago
although it's messed up anyway as
But that's because they wanted it to be like that.
To me, this code is very unclear:
int a, *b, c, d;
because everywhere else, multiple declarations in one statement all have the exact same type, but for some reason pointers get special treatment so that you can declare variables of type X and variables that are pointers to type X in the same statement, which just seems odd to me.
I'd be much happier if they were all strictly different and that
int* a, b, c, d;
did, in fact, declare all four variables to be pointer to int.
- ant6n 10y agoI'd say it's better style anyway to only ever declare multiple primitive types in the same statement.
- tzs 10y ago> [...] everywhere else, multiple declarations in one statement all have the exact same type, but for some reason pointers get special treatment so that you can declare variables of type X and variables that are pointers to type X in the same statement, which just seems odd to me. It's not just pointers: int a, *b, c();