How to obtain a slim version of a code...

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Cyrock
    New Member
    • Apr 2008
    • 1

    How to obtain a slim version of a code...

    Hi there, it would be amazing if someone could help me with this problem i am having.

    I have a big C code, with over 100 input global variables.

    What i need is a slim version of this code, where i am only interested in 1 of the outputs. Since it has to be executed in real time...all the other stuff only slows down the calculations.

    Is there any way I can figure out efficiently what variables i need for calculating this output so I can delete/comment the other inputs and the code that is not neccesary?

    If there is no tool avaliable for this...how should i do it efficiently by hand?

    Thanks in advance!
  • sicarie
    Recognized Expert Specialist
    • Nov 2006
    • 4677

    #2
    I don't think there is a tool available for this, but I could be wrong.

    I'd suggest taking that final variable and figuring out how it's calculated. Then, if the code is properly maintained, you can find the variables that go into it fairly easily.

    You can also start off with that variable that is printed and then search for all occurrences of that variable and see what and how other variables are combined to get that value.

    Comment

    • weaknessforcats
      Recognized Expert Expert
      • Mar 2007
      • 9214

      #3
      You do that by not using global variables. A specific calculation need only use variables specific to that calculation.

      Read this: http://bytes.com/forum/thread737451.html.

      Comment

      Working...