this post was submitted on 08 Oct 2023
1061 points (96.7% liked)

Programmer Humor

25699 readers
1456 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
 
you are viewing a single comment's thread
view the rest of the comments
[–] SquishyPandaDev@yiffit.net 46 points 2 years ago (2 children)

Obligatory, mutable global variables are evil.

[–] QuazarOmega@lemy.lol 10 points 2 years ago (1 children)

As opposed to immutable variables

*confused screaming*

[–] yiliu@informis.land 5 points 2 years ago (1 children)
[–] Eufalconimorph@discuss.tchncs.de 3 points 2 years ago* (last edited 2 years ago)
int const golden = 1.618;
int* non_constant = (int*)&golden;
golden = 1.61803399;

Casts are totally not a danger that should require a comment explaining safety…

And more generally mutable aliasing references of any sort are evil. Doesn't mean they're not useful, just that you need magic protection spells (mutexes, semaphores, fancy lock-free algorithms, atomics, etc) to use them safely. Skip the spell or use she wrong one, and the demon escapes and destroys all you hold dear.