4 ms·
> undefined behavior in C compilers My unpopular opinion is that UB fear is greatly exaggerated these days, especially by folks who want to capture developers
by scoutt 6y ago
> undefined behavior in C compilers
My unpopular opinion is that UB fear is greatly exaggerated these days, especially by folks who want to capture developers for their languages. Somehow, they bring it up every time they can. Is like every time you want to jump into your car, I jump from behind a bush just to tell you "remember car accidents!".
I write C for a living, for the past ~20 years (mostly for embedded/kernel/drivers). I can't recall my last UB problem (if any). It's true. Though, I did find myself reading the ASM output just to discover that some instruction was omitted or does weird things (compiler bug).
Don't forget that the world runs on C.
- pif 6y agoJust for the record, you share you unpopular opinion with me.
- whatshisface 6y agoThe world also runs on fossil fuels, politics and processed foods. ;)
- gens 6y agoWe can lower the fossil fuel consumption by writing more efficient software, in a more efficient programming language like C. It gets less processed as well. Don't have an idea for politics.
- foobiekr 6y ago100% agree.
- Jweb_Guru 6y agoUnless you are better than every other C programmer on the planet, I am quite confident I could easily find UB in your code as long as you worked with a team larger than a couple of people. If not in the stuff you wrote (though that's unlikely), then in other people's code that called yours without respecting invariants.