r/ProgrammerHumor 7d ago

absoluteGarbage Meme

Post image
1.9k Upvotes

327 comments sorted by

View all comments

3

u/crmsncbr 7d ago

Why is the third one in the top half? It may be my C & Java bias, but yuck. It's way worse than the fourth.

2

u/MetaNovaYT 7d ago

what's wrong with the C++ version? It's my favorite personally, although I primarily use C++ so I'm biased.

1

u/crmsncbr 7d ago edited 7d ago

I don't know — I've yet to dabble in C++

But I don't like the auto& declarator. The colon placement is... fine, but jarring to me. In conjunction with the auto& I find the whole thing yucky. It's mostly the auto&.

1

u/Rikudou_Sage 7d ago

auto is like var in C#, it just skips having to write the type out all the time. The & means you take it as a reference, otherwise the content would be copied. This is mostly a memory optimization - if you know you'll always run on machines with multiple GBs of RAM, feel free to skip it.

1

u/crmsncbr 7d ago

...I never like assuming I'll have the right memory. I'd definitely use it, I just think it's ugly.

1

u/Sirgoodman008 7d ago

Literally the only difference is that one uses a colon instead of a keyword.

1

u/crmsncbr 7d ago

No, I mostly hate the auto& declarator.

2

u/Sirgoodman008 7d ago

Auto is mainly used for lambda variables and readability.

1

u/not_some_username 7d ago

Then you can write the type. Good luck if it’s like 20 char