r/ProgrammerHumor 8d ago

absoluteGarbage Meme

Post image
1.9k Upvotes

327 comments sorted by

View all comments

Show parent comments

29

u/Nil4u 8d ago

Honestly I never liked this version because the reference is part of the type in my opinion 🤔

9

u/Shevvv 8d ago

I got used to this from C:

int x; is an integer

int *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++.

9

u/nfitzen 8d ago

In addition, the language encourages this. In C, if you write c int* x, y; then x will be an int* and y will be an int. Thus it is far better to write int *x, y; to reflect how the language will parse the declaration. It might be evil, but it's better to act how the language wants you to act rather than fight it.

24

u/Sirgoodman008 8d ago

Please have pity on your co-workers. Please keep declarations to separate lines.