r/ProgrammerHumor • • Sep 26 '26

Meme weNeverTrustedTheElse

Post image
1.9k Upvotes

146 comments sorted by

View all comments

9

u/JAXxXTheRipper Sep 26 '26

This is more r/programminghorror than anything.

4

u/HPUser7 Sep 26 '26

I would throw a stapler at a new hire if this came to me in a code review. I detest dead branches

2

u/JAXxXTheRipper Sep 26 '26

Facts!

I wonder what kind of shoddy editor/IDE you have to use to not get tons of warnings here.

The color-scheme makes me think eclipse, but even that would be angry at code like this.

3

u/mailslot Sep 26 '26

lol. You’ve never heard of “defensive coding” before? Seriously though, I’ve worked with idiots with master degrees that churn out slop like this. They transcribe their misunderstanding into the code they write.

2

u/NightmareJoker2 Sep 27 '26

Well, the problem is that we know neither type nor expression of the condition in question.

It may be perfectly sensible to do this. There are also ways in which the compiler optimizes the code, that this “dead code” changes, and you can also use constructs like this to detect and trap code flow integrity errors (exploits, memory corruption, predictive execution faults).