Hacker News new | ask | show | jobs
by cmccabe 4892 days ago
Wow, C and C++ have undefined behavior? I bet nobody knows that unless... they took an undergrad comp sci class.

Why is this on HN?

Use the right tool for the job. Sometimes that C or C++, sometimes it's not.

2 comments

There is substantially more sophistication to his points than you give him credit for. If someone who is an expert in something - and he is - says something about their area of expertise that you think is obvious and simple, consider perhaps that it's your level of understanding that is lacking, not theirs.
Academics have been whining about C and C++ since at least the 1980s. But if you ask any three academics what programming languages they like, you'll get three different answers, depending on what department and program they are in.

I'm sure Dr. Regehr is a smart guy, but I don't consider academics good sources of advice on software engineering, for the same reason I don't get sex tips from Catholic priests. Also, John Regehr's CV relates more to static analysis than software engineering anyway.

They have far too many undefined behaviors.

"Like leaving a string unfinished. You expect a compiler error right? Nope, undefined.

Any why should making an invalid pointer be undefined?

It becomes ridiculous to try to just remember the rules.