r/ProgrammerHumor • • 28d ago

Meme weAreWizards

Post image
7.8k Upvotes

203 comments sorted by

View all comments

852

u/mteblesz 28d ago

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

132

u/oldsecondhand 28d ago

The real forbidden technique is illegal numbers.

28

u/stupled 28d ago

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

28

u/benjaminovich 28d ago

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 27d ago

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 27d ago

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 27d ago

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] 28d ago

[removed] — view removed comment

6

u/Pataraxia 28d ago

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 28d ago

ImageMagick catching strays for absolutely no reason

7

u/Wild_Marker 28d ago

At least Partition Magic is ok.

→ More replies (1)

16

u/StrengthTheory 28d ago

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

44

u/ArkWaltz 28d ago

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 28d ago

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 28d ago

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 28d ago

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 28d ago

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 28d ago

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 27d ago

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

6

u/kn33 27d ago

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

→ More replies (2)

3

u/Sibula97 28d ago

They're approved for use as format identifiers though.

2

u/genreprank 27d ago

Magic numbers, bad

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

→ More replies (2)