r/ProgrammerHumor • • Oct 10 '26

Meme weAreWizards

Post image
7.8k Upvotes

203 comments sorted by

View all comments

852

u/mteblesz Oct 10 '26

"magic numbers" spell is stricktly forbidden technique, banned by most schools of programming. There are many rogue wizards though...

132

u/oldsecondhand Oct 10 '26

The real forbidden technique is illegal numbers.

28

u/stupled Oct 10 '26

This isn't magic, this is just a legal issue.

28

u/benjaminovich Oct 10 '26

You make it sound like we're talking about something silly like the state passed a law defining pi as 3 or 4 (I forget which).

But really it's just that any illegal content of any kind that is digitized will ultimately "just" be numbers at a certain level.

8

u/scumble_bee Oct 10 '26

Yeah, every image can be broken down into a series of pixels with x,y,r,g,b . So owning a text file with a number that can be extrapolated into an illegal picture is still illegal (at least that is what I think it means).

4

u/SoldRIP Oct 10 '26

So isn't the idea that pure information, like a number, could possibly be illegal a ridiculous one!? Surely knowledge cannot be banned in any free society?

→ More replies (1)

4

u/SoldRIP Oct 10 '26

That's just the warlocks' guild and their idea of forbidden techniques. A wizard does not care for such things!

(It's lawyers. Because you see they, too, form contracts with sketchy wording that screw you over at great cost to their mental and often physical health)

→ More replies (1)

108

u/[deleted] Oct 10 '26

[removed] — view removed comment

6

u/Pataraxia Oct 10 '26

I'm just a lurker but "What the fuck" as a comment got me wheezing lmao.

→ More replies (1)
→ More replies (2)

33

u/Suske15 Oct 10 '26

ImageMagick catching strays for absolutely no reason

7

u/Wild_Marker Oct 10 '26

At least Partition Magic is ok.

→ More replies (1)

16

u/StrengthTheory Oct 10 '26

I tell you they're not magic numbers, it's just 0 and 1

44

u/ArkWaltz Oct 10 '26

Actual real lines that were in my old work's codebase:

private final int ZERO = 0;
private final int ONE = 1;

Turns out having a linter blanket-deny all forms of 'magic number' had some odd results.

16

u/StrengthTheory Oct 10 '26

That's just good defensive programming in case the client decides tomorrow that all ones are now zeroes and vice versa. You never know.

9

u/iZian Oct 10 '26

I think in Java we have BigDecimal statics for zero and one.
Then again with a million records being processed and 90% needing a zero; it did save in 900k objects.
But for a primitive…

3

u/Spaceshipable Oct 10 '26

Swift has a builtin `.zero` as part of one of the numeric protocols. It’s handy for when you’re doing maths on generic types. I could see a `.one` being handy. Apparently Swift’s SIMD has that defined.

4

u/Chirimorin Oct 10 '26

C# has .Zero and .One for numerics as well, I can confirm that they're really handy when working with generic types.

6

u/ButWhatIfPotato Oct 10 '26

I have yet to meet an unfirable elder wizard who does not literally exfoliate magic numbers from every pore. I dare not question them for they are the only ones who know how to tame that severely crusty self-conscious fully sentient ancient tome wrapped in the skin of 1000 inbred homunculi, for if you anger it, it will surely take down the guild in a spectacular exploding fashion.

4

u/tknomanzr99 Oct 10 '26

Welcome to the Temple of the Binary God. Prepare to be integrated into the mainframe. Welcome to the collective.

6

u/kn33 Oct 10 '26

There's one exception: The fast inverse square root.

→ More replies (2)

3

u/Sibula97 Oct 10 '26

They're approved for use as format identifiers though.

2

u/genreprank Oct 10 '26

Magic numbers, bad

Magic filenames and foldernames, all the guru programmers use them.

→ More replies (2)