this post was submitted on 11 Feb 2025
460 points (97.1% liked)

Programmer Humor

20039 readers
1194 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS
 
top 47 comments
sorted by: hot top controversial new old
[–] [email protected] 2 points 50 minutes ago

What about stacks grows to higher addresses?

[–] MTK 11 points 3 hours ago (1 children)

Error handling should only be with "if"

Variable names must be generic and similar to each-other

Debugging is only done with prints

Version numbers must be incoherent, hard to order correctly, contain letters and jump in ways that don't align with the updates done.

[–] [email protected] 1 points 8 minutes ago

Variable names should be var{n} where n = 0, 1, 2...

[–] Thcdenton 5 points 3 hours ago

Halfway to Lua lol

[–] [email protected] 14 points 4 hours ago (1 children)

From this point on, all arrays are reverse-indexed.

[–] [email protected] 8 points 4 hours ago (1 children)
[–] [email protected] 4 points 3 hours ago

Hey now, you know that according to the Bible the biggest number is a million. Anything larger than that including infinity is some of that "woke shit".

Your array will be 999,999, 999,998, 999,997 ...

[–] [email protected] 49 points 7 hours ago (1 children)

reverting main back to master

[–] [email protected] 22 points 6 hours ago (2 children)

Yeah...this one is sadly on brand

[–] riodoro1 3 points 55 minutes ago

For this political correctness you get trunk.

[–] [email protected] 9 points 2 hours ago (3 children)

Sadly? Master branch never implied the existence of a slave branch. It was one of the dumbest pieces of woke incursion into tech.

[–] Maggoty 3 points 50 minutes ago

But why even? There's no risk to changing it and some risk to keeping it. That's the reason for the push to change it. Keeping something just because it's tradition isn't a good idea outside ceremonies.

[–] [email protected] 1 points 53 minutes ago

Yeah agreed. Just another piece of white devs acting like they knew better for everyone.

[–] chonglibloodsport 0 points 58 minutes ago

Yes exactly. It’s a reference to the recording industry’s practice of calling the final version of an album the “master” which gets sent for duplication.

[–] [email protected] 53 points 8 hours ago (4 children)

Git default branch renamed back from main to master

[–] phcorcoran 1 points 7 minutes ago

(Someone else made it but I can't find the source)

[–] [email protected] 1 points 38 minutes ago

Would be the most sane thing he's ever done.

[–] [email protected] 1 points 56 minutes ago

That one actually seems plausible, if he ever learns about that whole thing

[–] mEEGal 28 points 7 hours ago

and all the others start with "slave/"

[–] NOT_RICK_SANCHEZ 20 points 8 hours ago

He’s got to be in contact with the CEO of my company, this is trade secret theft if not…

[–] [email protected] 21 points 9 hours ago* (last edited 9 hours ago) (3 children)

GTFOH with that. 1-indexed arrays?! You monster.

(Mostly joking... Ok, somewhat joking :P )

[–] [email protected] 1 points 13 minutes ago (1 children)

Visual Basic used to let you choose if you wanted to start arrays at 0 or 1. It was an app-wide setting, so that was fun.

[–] [email protected] 1 points 10 minutes ago

I've not heard that name in a long time...

[–] [email protected] 27 points 8 hours ago (3 children)
[–] [email protected] 1 points 1 hour ago

This is one of the few things that I really don't like any Lua. It's otherwise pretty decent and useful.

[–] [email protected] 2 points 3 hours ago

Writing Lua code that also interacts with C code that uses 0 indexing is an awful experience. Annoys me to this day even though haven't used it for 2 years

[–] SpaceNoodle 33 points 8 hours ago (3 children)

Lua had been banned from the chat

[–] pelya 11 points 6 hours ago (3 children)

In Lua all arrays are just dictionaries with integer keys, a[0] will work just fine. It's just that all built-in functions will expect arrays that start with index 1.

[–] [email protected] 2 points 24 minutes ago

PHP did that same thing. It was a big problem when algorithmic complexity attacks were discovered. It took PHP years to integrate an effective solution that didn't break everything.

[–] [email protected] 6 points 3 hours ago

Your argument isn't making me any happier - it just fills me with more rage.

[–] [email protected] 2 points 2 hours ago (1 children)

That's slightly misleading, I think. There are no arrays in Lua, every Lua data structure is a table (sometimes pretending to be something else) and you can have anything as a key as long as it's not nil. There's also no integers, Lua only has a single number type which is floating point. This is perfectly valid:

local tbl = {}
local f = function() error(":(") end

tbl[tbl] = tbl
tbl[f] = tbl
tbl["tbl"] = tbl

print(tbl)
-- table: 0x557a907f0f40
print(tbl[tbl], tbl[f], tbl["tbl"])
-- table: 0x557a907f0f40	table: 0x557a907f0f40	table: 0x557a907f0f40

for key,value in pairs(tbl) do
  print(key, "=", value)
end
-- tbl	=	table: 0x557a907f0f40
-- function: 0x557a907edff0	=	table: 0x557a907f0f40
-- table: 0x557a907f0f40	=	table: 0x557a907f0f40

print(type(1), type(-0.5), type(math.pi), type(math.maxinteger))
-- number	number	number	number
[–] [email protected] 9 points 8 hours ago

Fortran angrily starts typing...

[–] [email protected] 3 points 8 hours ago (1 children)

Don't do my boy Lua dirty like that >:(

[–] [email protected] 12 points 7 hours ago (1 children)

I always felt that Lua was a girl

[–] [email protected] 16 points 7 hours ago

Lua - Portuguese feminine noun for "moon", coming from the Latin "luna"
Luna - Latin, feminine noun (coincidentally identical to the Italian noun, also feminine)

Yup, Lua is a girl.

[–] [email protected] 13 points 8 hours ago (1 children)

NGL, this kind of form of putting the decisions the monkey-in-charge is making in a way experts in a field will understand, is a very good way to showcase the absurdity.

[–] NABDad 2 points 4 hours ago

Are there really people capable of understanding this who aren't capable of understanding, for example, "tariffs increase inflation"?

[–] [email protected] 5 points 8 hours ago

I started reading that from the top and got increasingly angry on the way down. That creature is a monster.

[–] tgm 5 points 8 hours ago (3 children)

Haven't heard of the stack address thing, anyone got a TLDR on the topic?

[–] [email protected] 14 points 8 hours ago

https://softwareengineering.stackexchange.com/questions/386194/why-do-we-still-grow-the-stack-backwards

TL;DR: For historical reasons stacks growing down is defined in hardware on some CPUs (notably x86). On other CPUs like some ARM chips for example you can technically choose which direction stacks go but not conforming to the historical standard is the choice of a madman.

[–] [email protected] 4 points 8 hours ago

Pretty sure that it’s something a long the lines of “stack begins high, grows down, while heap behind low grows high” when they meet, it’s a stack overflow

[–] rockSlayer 1 points 8 hours ago

Dynamic stacks are pretty common in the most popular scripting languages, but considered bad practice from folks who use systems languages

[–] [email protected] 2 points 8 hours ago

didn't know donny was a forth programmer