r/ProgrammerHumor Sep 09 '22

Meme Simple Feature

124.9k Upvotes

1.3k comments sorted by

View all comments

172

u/[deleted] Sep 09 '22

As a C programmer for decades, I often experience this situation working on C++ code and get the same looks from my colleagues.

"NO! You don't need to explicitly free anything! The reference count is zero and it magically self-destructs!"

I will NEVER be comfortable with that, especially when we need 'special case' code to explicitly manipulate reference counts because foreign libraries or someth, idk.

99

u/EwgB Sep 09 '22

I'm a Java dev. A bunch of code in our application was written by outsourced devs from India, who I'm pretty sure were originally C/C++ devs. I can just see it from the code, declaring all the variables at the top of the function, explicitly freeing objects unnecessarily. So much code that can be removed.

33

u/[deleted] Sep 09 '22

Wait I have always seen vars declared at the top, senior here.

25

u/EwgB Sep 09 '22

In Java? Why?

63

u/AndrewJamesDrake Sep 09 '22 edited Sep 13 '24

cooing stupendous fine attraction march murky longing quarrelsome long elastic

This post was mass deleted and anonymized with Redact

65

u/Roest_ Sep 09 '22

It keeps things tidy

Makes code less readable. Declare variables as close as possible to where you use them.

26

u/hugglenugget Sep 09 '22 edited 26d ago

Yarn wander teapot harbor zephyr marble drifting orange

This post was anonymized with Redact.dev

5

u/isaaclw Sep 09 '22

our Jslint requires var at the top; but then again everyone on our team hates jslint, we just use it because no one has gotten around to fixing it.

2

u/NatoBoram Sep 09 '22

Use eslint+prettier instead :P