|
|
|
|
|
by thought_alarm
4704 days ago
|
|
You don't have it wrong. In an object-oriented context, whether you're working in C, C++, or Obj-C, it is entirely reasonable to attach the asterisk to the type name, and treat `MyObject* ` as a type. For every weird little edge case where `MyObject* ` doesn't make sense, there are hundreds of examples where it makes complete sense. I've been doing it that way since I started in the 90s, and I've always felt the people who do it the old way (attaching the asterisk to the variable name) are either holding on to an obsolete bit of antique C style, or they don't know what they're doing. It has no place in modern object-oriented code. So what about `int* a, b, c;`? Never declare multiple variables on one line like this. |
|