jeudi 5 avril 2018

What's up with the endless bleating about UB?

Not really a question, more I wanted to "test the water".

Following the C++ forums for many years, I have grown weary of the number of abstract and esoteric arguments over the exact meaning of the standards document.

From many decades as a professional programmer, my opinion is...
a) Compilers are written by programmers
b) Programmers write bugs
c) Therefore compilers contain bugs

Combine with
a) More obscure features receive less testing.
b) More obscure features are more likely to have tests that are wrong.
c) Therefore more obscure features contain more bugs.

Which leads to two observations.
a) If you only care that YOUR project works, compile it on your compiler(s) and examine the assembler.
Comment it as platform-specific, even better use a pragma warning. Don't beat yourself up. Using compiler-specific behaviour does not make you a bad programmer. You are paid to make a working project, your project works, job done.
b) If you want your code to work on ANY platform, accept that compilers will always contain bugs. Those bugs mean C++ can ever be "completely portable". Restrict yourself to well known/used C++ features. Don't beat yourself up over the fact your code is more verbose than it could be.

Either way, the contents of the standards document is irrelevant... This is not an excuse not to learn/use new features. (Different argument) It is an excuse not to hang success/failure of your project on the exact meaning of "atomic".

So my question is... what is so wrong with this conclusion that it produces a "flame-war" every time.

Aucun commentaire:

Enregistrer un commentaire