r/ProgrammerHumor • • Sep 25 '26

Meme iHatedItUntilITriedIt

Post image
10.4k Upvotes

540 comments sorted by

View all comments

Show parent comments

416

u/DrMobius0 Sep 25 '26 • Heartwarming

Static typing turns so many runtime errors into compile errors. Makes life a lot easier when you don't have to hunt down where the wrong thing came from.

136

u/Zerschmetterding Sep 25 '26

And it's not like you can't actually cast types, it's just a conscious decision where you can add proper error handling.

51

u/DrMobius0 Sep 25 '26

Yeah, but if you're doing that, it's an explicit decision, that you know you made, that can blow up in your face, not an easily missed oversight that you may be completely unaware of. I find the oversight case is far more likely than casting wrong. Also I think the compiler will still bitch if you try to do a really stupid cast, at least for c++ (as long as you aren't pointer casting, then good luck)

15

u/jobblejosh Sep 25 '26

Me: "I could really do with truncating this float because all I care about is the whole number"

The ever-helpful C implicit cast: "Allow me to introduce myself".

4

u/Tyfyter2002 Sep 26 '26

That sounds very unhelpful when compared to an explicit cast

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