This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: [off topic] fallow code removal
- From: Bernd Jendrissek <berndj at prism dot co dot za>
- To: John Love-Jensen <eljay at adobe dot com>
- Cc: MSX to GCC <gcc-help at gcc dot gnu dot org>, gcc at gcc dot gnu dot org
- Date: Sat, 6 May 2006 01:56:14 +0200
- Subject: Re: [off topic] fallow code removal
- References: <C0809F23.FC9D%eljay@adobe.com>
-----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-----