[C-safe-secure-studygroup] Unreachable v Dead Code

Wheeler, David A dwheeler at ida.org
Fri Mar 17 13:59:55 UTC 2017


Andrew Banks:
> But back to the key point: I would (probably as you would expect) argue quite
> strongly that there should be no unused {whatevers}, whether from a security
> or a safety profile viewpoint.  Whether this is framed as one rule or several
> rules is for others to decide!

If we're talking about the code specifically written for a particular project, that makes sense, but the devil is in the details:
1. In many cases software typically has code that is not used for a specific environment.  E.G., in #idef BIG_ENDIAN  ... #else ... #endif, only part is used in a specific environment.  So by "dead code" I presume we mean "code that cannot possibly be used in any environment".
2. This must ONLY apply to the software written for a particular project.  Software systems in many cases are mostly libraries, with a little custom code to glue them together.  Most of a library is typically NOT used, and the effort to *remove* unused code from libraries *increases* the risk of problems (in particular, whether it's manual or automated, there's always the risk of a mistake).

--- David A. Wheeler



More information about the C-safe-secure-studygroup mailing list