RE: [GD-General] remove unused functions
Brought to you by:
vexxed72
From: Tom F. <to...@mu...> - 2003-05-19 19:45:07
|
Maybe you can add a prologue to every function that does two things: (a) declares a static instance of a class whose constructor adds the string "__FILE__ __LINE__" to a table. (b) when it is called, finds and removes the string from the table. Play the game for a while, go through as many different codepaths and behaviours as you can think of, then dump the table to disk or whatever. And there you go - a list of all the functions (well, where they are - maybe there's a MS #define that lists the function name?) that haven't been called this time around. Then add ASSERT (!"Nobody ever calls me or they would have removed this assert") to each file, leave it a couple of weeks, and then kill all the functions that still have that assert. Tom Forsyth - Muckyfoot bloke and Microsoft MVP. This email is the product of your deranged imagination, and does not in any way imply existence of the author. > -----Original Message----- > From: Corrinne Yu [mailto:cor...@sp...] > Sent: 19 May 2003 19:58 > To: gam...@li... > Subject: [GD-General] remove unused functions > > > The game engine and game code base has gotten very very big. And it is > about time to clean things up and improve its structure and > documentation. > > One thing I would like to do to it is to start removing un-used > functions. I tried to use MSDev to remove un-referenced functions as a > start but didn't find any. It turns out quite a few of the "un-used" > functions are "referenced" (and thus can't be that easily > automatically > determined) but I know from how the game and engine code is > supposed to > run that they won't ever be called. > > They are not exactly unreachable code either, so doing the unreachable > code thing also doesn't work. > > I truly "dread" :D the idea to have to manually step through all the > code and manually cull out every single un-used function by > hand (it is > a lot of code to wade through!). I wonder what tools exist inside of > MSDev (or simple easy to use small external tools) that can help me in > my highly un fun task of cleaning up my code base, specifically in the > task of removing "un-used" functions. > > Thank you for your experience in this task, and your suggestions. > > > > ------------------------------------------------------- > This SF.net email is sponsored by: ObjectStore. > If flattening out C++ or Java code to make your application fit in a > relational database is painful, don't do it! Check out ObjectStore. > Now part of Progress Software. http://www.objectstore.net/sourceforge > _______________________________________________ > Gamedevlists-general mailing list > Gam...@li... > https://lists.sourceforge.net/lists/listinfo/gamedevlists-general > Archives: > http://sourceforge.net/mailarchive/forum.php?forum_id=557 > |