by kstrauser · 7y ago · 0 comments
Sure portability increases code quality, but at what cost to time to market which seems to be the primary concern for most developers these days?
Is there a major router vendor or something else that uses NetBSD in a big way?
Hotpoint, pioneer, bose, Samsung (some TVs and audio equipment), whirlpool and many, many more.
They all use netbsd in firmwares.
However, I do agree that cross compiling is good for finding bugs like this. And really if we are letting the compiler or architecture define undefined behavior, I find it better to break out the inline assembly. It's explicit that this code is platform dependent, and avoids any issues that a subtle change in the future may cause it to break.
Although, it's usually possible to define what your attempting in C without issue, and I only ever find I am doing such a thing if there is a good reason to use a platform specific feature. Generally, relying on how compiler handles uninitialized memory and similar is not what I call a compelling platform specific feature. Cross compiling is good in the regard because it forces everyone working on a project to avoid those things.
That is implementation defined, not undefined, behavior.
But if the standard says it's UB, it's UB. End of story.