[off topic] fallow code removal
Bernd Jendrissek
berndj@prism.co.za
Sat May 6 00:00:00 GMT 2006
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Fri, May 05, 2006 at 06:20:19AM -0500, John Love-Jensen wrote:
> One of my project's general on-going tasks is to eliminate dead code.
> Sort of following the Extreme Programming principle.
If you're doing XP then you also have a test suite that covers all the
code that you *actually* need, because you wrote the tests first to
reflect the requirements, and then edited the code until it passed.
Compile your codebase with -fprofile-arcs -ftest-coverage, and then run
the test suite. Use gcov to find code that never gets around to getting
run; either it purports to implement correct behaviour under strange
circumstances (fix the bug in your test suite - it is incomplete - write
a test!), or someone was trying to be too cleverer and added untested
(and un-run!) code: eliminate it once you agree it is indeed fallow.
(I speak of wishful thinking about my own code base, not out of positive
experience with this technique.)
- --
It is manipulative to not be manipulative.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Please fetch my new key 804177F8 from hkp://wwwkeys.eu.pgp.net/
iD8DBQFEW+X5wyMv24BBd/gRAutsAJ9f6WbmIx+/hEmmc95283/bw77ZCgCfQ14T
BKc5ti8qSNr4Qg9eM6e9fi8=
=QqGv
-----END PGP SIGNATURE-----
More information about the Gcc
mailing list