4 ms·
There is a lot of code written and released that doesn't follow the standard to the letter. New compilers with new optimizations that require strict language ad
by maximilianburke 11y ago
There is a lot of code written and released that doesn't follow the standard to the letter. New compilers with new optimizations that require strict language adherence otherwise they generate broken programs cause issues for the developers but, most importantly, the users.
The memcpy/memmove debacle could have been avoided entirely if memcpy performed a simple check about what was being copied where and changed the direction of the copy based on that. Simple, cheap, and an entire class of bugs can be avoided.
People should still be aware of the behavior of their development system but the system shouldn't punish when a slightly wrong choice is made.
Optimizations are great but software that continues to function is even better.
- sharpneli 11y agoIt's a strain on portability. Instead of just having a C or C++ program you actually have MSVC++ program (this is actually really common) or GCC program or clang program. Sure one can argue that the C standard is too lax. But these kind of errors come simply from the fact that people learn C by trial and error, which doesn't work with that language. Personally as long as the compilers still allow one to enable the optimizations it's not that bad in the end. Portability issues for badly written programs remain however.