Solved

Filtering out unused functions.

Posted on 2001-07-02
10
530 Views
Last Modified: 2013-11-20
Hi All
I was wondering if there is an easy way to know whether a function in a project is used or not.
The reason for this is , I have a project devoleped over the years by so many programmers and have a lot of redundant functions in it which may be not used in the currect version.

I tried with profiler but it gives only information about the functions executed at runtime.

Any help is greatly appreciated
thanks
Fleming
0
Comment
Question by:softfgk
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
10 Comments
 
LVL 32

Expert Comment

by:jhance
ID: 6246020
The VC++ linker automatically leaves unused functions out of the linked EXE or DLL.  If you want to see what is included, use the Visual Studio DEPENDS.EXE tool or the command line tool DUMPBIN /IMPORTS
0
 

Author Comment

by:softfgk
ID: 6246189
well that will show which all functions have you imported into ur exe module.
thats not what i want.
I am looking for someway to findout unused functions within that EXE
0
 
LVL 3

Expert Comment

by:cypherljk
ID: 6246216
I don't know of quick way but how about getting a bump of all the function symbols and them doing a search/find on your code text to see where the functions are called. This is not a pretty solution and I'm going to try jhance's to see if it works

My 2 cents...
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 32

Expert Comment

by:jhance
ID: 6246286
PLEASE EXPLAIN!  You said a profiler didn't do what you want because it only works at run time.  That is true.

The DEPENDS shows you which functions are included in the EXE file.  Unless you do something stupid in your linker setup, it will NOT include any unreferenced functions in your EXE after it links your program.
0
 

Author Comment

by:softfgk
ID: 6246329
hah
dont u get it ?
>The DEPENDS shows you which functions are included in the >EXE file
thats true . but only functions which you have imported from other modules.

Here i am trying to clean up the goddamn code by getting rid of the functions in the EXE which are never called(even if it is not included in the final EXE by the linker)
0
 
LVL 32

Expert Comment

by:jhance
ID: 6247061
I'm sorry but I cannot be of any further help.  Clearly, you know much more than I do here.....

Good luck with your project.
0
 

Expert Comment

by:gilad_no
ID: 6247556
You can use the Source Browser. It can show you every call to the function in your project. If you don't see any call to it, you can safely remove the function from your project. I used it on my project and it works fine.
0
 

Author Comment

by:softfgk
ID: 6249575
Hi guys
the tool Understanding for c++(from scitools.com) really did what i wanted
Initially i was going for rational pure coverage and numega true coverage. But both gives runtime analysis only like profiler which comes with VC++ itself.

thanks all for ur suggestions
Fleming
0
 
LVL 23

Expert Comment

by:Roshan Davis
ID: 9490230
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

PAQ'd and pts refunded

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Roshan Davis
EE Cleanup Volunteer
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 9537255
PAQed, with points refunded (100)

Computer101
E-E Admin
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
has22 challenge 11 107
pre4 challenge 19 110
child constructor and parent constructor, overriding and overloading 6 93
zeroFront challenge 7 122
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question