3 ms·
A big part of the author's argument is 'portability is simplicity'. That's the reason why it produces more reliable code. What is meant by that? I understand i
by snickerer 5y ago
A big part of the author's argument is 'portability is simplicity'. That's the reason why it produces more reliable code.
What is meant by that? I understand it like: don't write platform-specifc hacks. These rely on assumptions about behavior definitions for in general non-defined behavior.
An example: sometimes you can read meaningful data from memory after a free() because no one overwrote it. On your platform in your situation this can work.
It is clear for everyone that this is a bad idea. It would be great to have a low cost tool that tells you about such a bug. One class of tools for this are sanitizers. The author proposes another additional class of tools: testing your program with a run on another platform.
And why this could lead to more simplicity in the source code?
A use-after-free bug comes from too much complexity. The programmer couldn't keep all the complexity in his or her mind. I bet in general well-written solutions without platform-specific assumptions look more simple and are better to understand for a human.
Clearer code because of more found bugs because of an extra bug-finding tool (cross-platform testing).