[sldev] [VIEWER] Dead code removal

Soft Linden soft at lindenlab.com
Tue Sep 4 07:08:59 PDT 2007


On 9/4/07, Dirk Moerenhout <blakar at gmail.com> wrote:
> I've been working on particles and have run into quite a lot of dead
> code. What are we supposed to do with it?
>
> I consider it dead if:
> a) It's a class, method ... that is never referenced (or only
> referenced by elements that are in turn dead)
> b) A conditional statement that has only one possible result is
> keeping the code from being executed
> c) The code is executed but the result is unused
> d) It's a placeholder returning a default value.
>
>
> Personally I'd like to remove all of it.

I'd ask case by case on the list if you want to ensure you're not
burning up a lot of time on excising something that's actually there
by design. But in a system that's been reworked a number of times,
such as particles, it's almost certain that there's cruft left over.

The same goes for stripping out dead code that goes with other kinds
of cleanup: If you're near it, do it. Just be careful that you don't
overreach and create a ten file patch for a one file feature. Past
some point, cleanup gets riskier than crufty but tested, code.


More information about the SLDev mailing list