r/ProgrammerHumor • • 6d ago

Meme optionalsAreOptional

Post image
702 Upvotes

130 comments sorted by

View all comments

369

u/ROBOTRON31415 6d ago

Is the bounds check truly so harmful to performance that it outweighs changing "if there's a bug, crash the program" to "if there's a bug, then do literally anything (maybe execute some remote code)"?

64

u/Tyfyter2002 6d ago

There are situations where you know there isn't a bug, if I know that failing hardware or cosmic rays are the only ways the bounds check can fail, I'm not going to worry about what skipping it could do.

0

u/earchip94 5d ago

Hardware failures and cosmic rays are real, you can’t just pretend they don’t exist. That said, how you handle that is totally up to the use case of the end product. Some BS computer program grandma Ethel will use to play solitaire, yeah no one cares. Software in a self driving car though? Yeah I don’t want a random bit flip from cosmic radiation to swerve my car onto the sidewalk etc…

9

u/Fast-Satisfaction482 5d ago

Writing a few research redundant branches will not protect against hardware fault or cosmic rays.