looking for dead code removal

This is a discussion on looking for dead code removal within the C Programming forums, part of the General Programming Boards category; Hey y'all, I'm new to C programming, and my first task is to modify some code that was apparently written ...

  1. #1
    Unregistered
    Guest

    looking for dead code removal

    Hey y'all,

    I'm new to C programming, and my first task is to modify some code that was apparently written by a really lazy guy. It looks like about half the code is dead, and I could really use a little free utility to go through the source and highlight the dead code. Has anyone seen that?

  2. #2
    Mayor of Awesometown Govtcheez's Avatar
    Join Date
    Aug 2001
    Location
    MI
    Posts
    8,825
    "Dead" code? What do you mean?

  3. #3
    Unregistered
    Guest
    Dead code is functions that are never called anywhere, variables that are never used, and the like. It tends to collect in longer programs every time changes are made.

  4. #4
    Mayor of Awesometown Govtcheez's Avatar
    Join Date
    Aug 2001
    Location
    MI
    Posts
    8,825
    Hmm... not if they're updated correctly...

    I'd say just go through and kill them by hand.

  5. #5
    Registered User
    Join Date
    Sep 2001
    Posts
    11

    Arrow This is something you could try

    Most C/C++ Compilers highlight code that is not run, and variables that are initialised, but never used.

    Even compilers as old as Turbo C 1.02 warn you if a variable is intialised and not used.

    It would be a good idea to load the code with a new-ish compiler and look at all of the errors and warnings that it finds. Then you can work through and eradicate each problem, one by one. When you finish, the code will have all of the "dead" stuff removed.
    With my naked eye I saw all the falling rain, coming down on me...

  6. #6
    Unregistered
    Guest
    Thank everybody

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Proposal: Code colouring
    By Perspective in forum A Brief History of Cprogramming.com
    Replies: 28
    Last Post: 05-14-2007, 08:23 AM
  2. Values changing without reason?
    By subtled in forum C Programming
    Replies: 2
    Last Post: 04-19-2007, 11:20 AM
  3. Obfuscated Code Contest
    By Stack Overflow in forum Contests Board
    Replies: 51
    Last Post: 01-21-2005, 04:17 PM
  4. Updated sound engine code
    By VirtualAce in forum Game Programming
    Replies: 8
    Last Post: 11-18-2004, 12:38 PM
  5. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 06:06 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21