News for hackers. Stuff that matters.
Re:Modern C [pdf] by adamnemecek on Monday November 28, 2016 @09:24AM (#13055534)
How detailed is your knowledge of undefined behavior?
Re:Modern C [pdf] by module0000 on Monday November 28, 2016 @09:41AM (#13055639)
We know when undefined behavior will occur(the specs are written very clearly), but not what will happen when it occurs. Our job as competent C programmers is to avoid undefined behavior. C isn't hard(perhaps tedious to do correctly) - it does exactly what you tell it to.
Re:Modern C [pdf] by mathw on Monday November 28, 2016 @11:01AM (#13056226)
It does, but it's unnecessarily difficult to keep track of all the places undefined behaviour might occur and make sure you don't step into any of them under any conditions ever.

We shouldn't have to work like this anymore. C's been an amazing language, but it's getting time to gently, respectfully, move on. There's active and interesting development in alternatives which attempt to retain C's primary advantages while also allowing the compiler to keep you out of trouble as much as possible.

We have hugely powerful computers available to use as developers. We can contemplate designing and compiling languages with a complexity which would have completely defeated the systems available when C was developed. Why shouldn't we use some of that power to make our lives easier?

Re:Modern C [pdf] by adrianN on Monday November 28, 2016 @10:16AM (#13055907)
You'd be hard pressed to find a non-trivial C program that doesn't contain any undefined behavior.
Re:Modern C [pdf] by sidlls on Monday November 28, 2016 @01:32PM (#13057365)
Depends on what you mean by "non-trivial," I should think.
Re:Modern C [pdf] by pcwalton on Monday November 28, 2016 @10:55AM (#13056185)
> it does exactly what you tell it to.

This is a tautology.

What do you expect to happen on signed overflow?