Re: Dead code stripping, what does it strip?
Re: Dead code stripping, what does it strip?
- Subject: Re: Dead code stripping, what does it strip?
- From: Chris Espinosa <email@hidden>
- Date: Mon, 9 Aug 2004 11:30:45 -0700
On Aug 9, 2004, at 4:53 AM, Allan Odgaard wrote:
I was curious, does the dead-code stripper only strip my own functions
which I do not use myself?
Cause if that is the case, how often does that really happen in
real-life? I tried to recompile one of my own projects, enabling full
debug symbols and the dead code stripper, but the resulting executable
(after running 'strip' on it) was 1.5 MB, which was exactly the same
size as before I got Xcode 1.5.
I also tried the simple C++ tool, which becomes around 353 KB, but
here that was also the size after stripping dead code, although there
must be a lot of dead code in that executable, since it only does a
;cout << "Hello, world!\n"+.
There is by definition no dead code in that simple C++ tool, because it
has only one function, main().
Dead code stripping strips functions that are compiled into an
executable but not referenced by any other function. This can happen
in several ways:
- You inherit a library of source that you build into your product, but
you only use selected entry points. You don't know what part of the
source those entry points use, so you have to include all the sources
even if you only use a thin slice of them
- Your code has grown over the years with things being added and
removed. You can't readily tell whether individual functions in a
source file are used by anybody anymore, and you want to shrink your
binary without going through the hard work of figuring out what is
actually used
Remember that dead code (in this sense) is different than code that's
been #ifdefed out by preprocessor flags; the code must still be legal
and compile (and, in fact, link correctly even if it is not used).
Chris
_______________________________________________
xcode-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/xcode-users
Do not post admin requests to the list. They will be ignored.