this post was submitted on 22 Jul 2025
407 points (98.1% liked)

Programmer Humor

25282 readers
652 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
 

I don't think that casting a range of bits as some other arbitrary type "is a bug nobody sees coming".

C++ compilers also warn you that this is likely an issue and will fail to compile if configured to do so. But it will let you do it if you really want to.

That's why I love C++

you are viewing a single comment's thread
view the rest of the comments
[โ€“] mormegil@programming.dev 6 points 3 days ago (1 children)

I understand the idea. But many people have hugely mistaken beliefs about what the C[++] languages are and how they work. When you write ADC EAX, R13 in assembly, that's it. But C is not a "portable assembler"! It has its own complicated logic. You might think that by writing ++i, you are writing just some INC [i] ot whatnot. You are not. To make a silly example, writing int i=INT_MAX; ++i; you are not telling the compiler to produce INT_MIN. You are just telling it complete nonsense. And it would be better if the compiler "prevented" you from doing it, forcing you to explain yourself better.

I get what you're saying. I guess what I'm yelling at the clouds about is the common discourse more than anything else.

If a screw has a slotted head, and your screwdriver is a torx, few people would say that the screwdriver won't allow them to do something.

Computers are just tools, and we're the ones who created them. We shouldn't be submissive, we should acknowledge that we have taken the wrong approach at solving something and do it a different way. Just like I would bitch about never having the correct screwdriver handy, and then go look for the right one.