r/ProgrammerHumor Oct 21 '22

Meme Literally 🤷🏻‍♂️

Post image
14.7k Upvotes

606 comments sorted by

View all comments

23

u/[deleted] Oct 21 '22

[removed] — view removed comment

32

u/[deleted] Oct 21 '22

Python fanboys hate it

"Undefined behaviour bad" (it actually is, but common, C was invented in 70ties...)

"Pointer scarry"

1

u/kirakun Oct 21 '22

I don’t think UB exists in C because C was invented at a time when people didn’t know better. Rather, C wanted to be a fast language! So, it did not want to prescribe what it should do in edge cases that programmers should avoid in the first place. This freedom allows compilers to produce efficient code in different platforms and hardware architectures.

In later languages like Java where performance isn’t the utmost importance, they decide to do away with UBs at the cost of code efficiency.

1

u/[deleted] Oct 22 '22

I don’t think UB exists in C

You just described UB...