BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Finding dead code ?

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Non-Technical)
View previous topic :: View next topic  
Author Message
Sten Larsson
Guest





PostPosted: Wed May 12, 2004 3:55 am    Post subject: Finding dead code ? Reply with quote



And now for something completely different...

I'm looking for a source cross reference tool that can give me a list
of functions and parameters that are not called/referenced - without
too much manual work. The input would of course be all the source
code.

I own CDOC (www.swbs.com) - but have not been able to instruct it go
give me what I want.

I need to shrink an embedded app. The linker does not optimize away
dead code....

Oh ... yes I'm too excited about the c++ developments at Borland :-)

/sten
---
For direct email, remove _ and X.
Back to top
Ed Mulroy [TeamB]
Guest





PostPosted: Wed May 12, 2004 5:28 am    Post subject: Re: Finding dead code ? Reply with quote



I don't know of a software tool to figure that out.

I know for non-class functions and variables that I by default label
them as 'static'. If they are not used inside the file then the
compiler will generate a warning telling you that. Since good
programming practice says to minimize the number of global variables
they shouldn't be much of a problem to handle. For global functions
it's pretty easy to see if or where they are called by using grep.

.. Ed

Quote:
Sten Larsson wrote in message
news:5c73a09559gdulifaqo0lp63fau4eb01e9 (AT) 4ax (DOT) com...
And now for something completely different...

I'm looking for a source cross reference tool that can give
me a list of functions and parameters that are not
called/referenced - without too much manual work. The
input would of course be all the source code.

I own CDOC (www.swbs.com) - but have not been able to
instruct it go give me what I want.

I need to shrink an embedded app. The linker does not
optimize away dead code....

Oh ... yes I'm too excited about the c++ developments at
Borland Smile



Back to top
Chris Mylonas
Guest





PostPosted: Wed May 12, 2004 7:38 am    Post subject: Re: Finding dead code ? Reply with quote



Take a look at Turbo Power's Sleuth QA Suite (try on sourceforge).

"Sten Larsson" <s_t_enX (AT) Xs_ten_l (DOT) com> wrote

Quote:
And now for something completely different...

I'm looking for a source cross reference tool that can give me a list
of functions and parameters that are not called/referenced - without
too much manual work. The input would of course be all the source
code.

I own CDOC (www.swbs.com) - but have not been able to instruct it go
give me what I want.

I need to shrink an embedded app. The linker does not optimize away
dead code....

Oh ... yes I'm too excited about the c++ developments at Borland :-)

/sten
---
For direct email, remove _ and X.



Back to top
Kenneth de Camargo
Guest





PostPosted: Wed May 12, 2004 10:55 am    Post subject: Re: Finding dead code ? Reply with quote

Chris Mylonas wrote:

Quote:
Take a look at Turbo Power's Sleuth QA Suite (try on sourceforge).

Only the component libaries were opensourced, AFAIK.


--
Ken
http://planeta.terra.com.br/educacao/kencamargo/
* this is not a sig *

Back to top
Alex Bakaev [TeamB]
Guest





PostPosted: Wed May 12, 2004 6:45 pm    Post subject: Re: Finding dead code ? Reply with quote

Sten Larsson wrote:
Quote:
And now for something completely different...

[snip]

One way is to run your application under debugger. The code that is not
referenced by anybody will not have blue dots in the left gutter. Such
code can be removed safely. Of coruse, one has to be careful about the
conditionally compiled code.

..a

Back to top
Peter Agricola
Guest





PostPosted: Wed May 12, 2004 7:00 pm    Post subject: Re: Finding dead code ? Reply with quote


"Alex Bakaev [TeamB]" wrote:
Quote:
One way is to run your application under debugger. The code that is not
referenced by anybody will not have blue dots in the left gutter.

In a perfect world. Unfortunately BCB is far from perfect.
Today I was stepping through code without having dots. I was very upset I
couldn't set breakpoints. I had to set them on code wich calls the 'code
without dots', and start stepping there. This happens many times to me (in
BCB5).

Quote:
Such
code can be removed safely. Of coruse, one has to be careful about the
conditionally compiled code.

Don't throw it away to soon. Use a good CVS.

Peter



Back to top
Andrue Cope
Guest





PostPosted: Thu May 13, 2004 8:15 am    Post subject: Re: Finding dead code ? Reply with quote

On Wed, 12 May 2004 21:00:08 +0200, Peter Agricola wrote:

Quote:
In a perfect world. Unfortunately BCB is far from perfect.
Today I was stepping through code without having dots. I was very upset I
couldn't set breakpoints. I had to set them on code wich calls the 'code
without dots', and start stepping there. This happens many times to me (in
BCB5).

My colleague suffers that in BCB6. The odd thing is I never do and we share
the same projects.
--
Andrue Cope
[Bicester UK]

Back to top
Alex Bakaev [TeamB]
Guest





PostPosted: Thu May 13, 2004 4:47 pm    Post subject: Re: Finding dead code ? Reply with quote

Andrue Cope wrote:

Quote:
My colleague suffers that in BCB6. The odd thing is I never do and we share
the same projects.


Often such problems are caused by two files with the same name opened in
the IDE.

..a

Back to top
Ed Mulroy [TeamB]
Guest





PostPosted: Thu May 13, 2004 4:56 pm    Post subject: Re: Finding dead code ? Reply with quote

I've also had that problem when the 'same name' file is actually the
same file opened in each of two edit windows in the IDE. That was
with an earlier version of BCB but my guess it also applies to BCB6.

As to if it was stupid for me to do that, sure.

.. Ed

Quote:
Alex Bakaev wrote in message
news:40a3a6af$1 (AT) newsgroups (DOT) borland.com...

My colleague suffers that in BCB6. The odd thing is I
never do and we share the same projects.

Often such problems are caused by two files with the
same name opened in the IDE.



Back to top
Tamas Demjen
Guest





PostPosted: Thu May 13, 2004 9:27 pm    Post subject: Re: Finding dead code ? Reply with quote

Quote:
In a perfect world. Unfortunately BCB is far from perfect.
Today I was stepping through code without having dots.

It happens every day. Just close the project and open it again. If
you're lucky, it won't even recompile anything.

Tom

Back to top
Andrue Cope
Guest





PostPosted: Fri May 14, 2004 8:04 am    Post subject: Re: Finding dead code ? Reply with quote

On Thu, 13 May 2004 12:56:36 -0400, Ed Mulroy [TeamB] wrote:

Quote:
As to if it was stupid for me to do that, sure.

It can happen as the result of the 'current working directory' bug that I
reported on QC. Any file not in a folder underneath the project directory
can be opened by the IDE in one of two ways:Either using a relative or an
absolute path. When loaded into the IDE the editor treats them like
separate files.
--
Andrue Cope
[Bicester UK]

Back to top
Sten Larsson
Guest





PostPosted: Fri May 14, 2004 5:34 pm    Post subject: Re: Finding dead code ? Reply with quote

"Sten Larsson" <s_t_enX (AT) Xs_ten_l (DOT) com> wrote

Quote:
And now for something completely different...

Thanks everyone...

I have found a tool - Understand for c++

http://www.scitools.com

Pricey - $500 - but it does the job.

/sten



Back to top
Randall Parker
Guest





PostPosted: Fri May 14, 2004 7:27 pm    Post subject: Re: Finding dead code ? Reply with quote

Sten,

Does it have any problems processing the Borland extensions? Have you run a complete
BCB project thru it?

Does it find all source code that doesn't get used? At what level of granularity?
Method? Class?

Does it identify uninitialized and unused variables?

Does it do other useful things? What do you like about it?

Sten Larsson wrote:

Quote:
I have found a tool - Understand for c++

http://www.scitools.com

Pricey - $500 - but it does the job.

/sten



Back to top
Sten Larsson
Guest





PostPosted: Sat May 15, 2004 7:41 am    Post subject: Re: Finding dead code ? Reply with quote

Randall Parker wrote:
Quote:
Does it have any problems processing the Borland extensions? Have you run a complete
BCB project thru it?

Does it find all source code that doesn't get used? At what level of granularity?
Method? Class?

Does it identify uninitialized and unused variables?

Does it do other useful things? What do you like about it?

Hi Randall - sorry - but I have not gone into the details of it. Just
tried it and it does solve my problem - i.e. to identify unused
functions in plain c for an embedded application.

Apart from that, I have really not looked at it too carefully.

/sten
---
For direct email, remove _ and X.

Back to top
Sten Larsson
Guest





PostPosted: Sat May 15, 2004 7:42 am    Post subject: Re: Finding dead code ? Reply with quote

Oh - I am using the 14 day evaluation version.


/sten
---
For direct email, remove _ and X.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Non-Technical) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.