[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

BeeJ

12/3/2011 2:16:00 AM

Unused Subs/Functions
I expect that the compiler just ignores unused subs and functions.

How do I find then in the source so I can clean up?
MZ-Tools does not seem to have anything for that or maybe I just do not
know the terminology.

Anything else out there that will do that? All I need is a list and I
can do the cleanout.


9 Answers

ralph

12/3/2011 3:51:00 AM

0

On Fri, 02 Dec 2011 18:16:17 -0800, BeeJ <nospam@spamnot.com> wrote:

>Unused Subs/Functions
>I expect that the compiler just ignores unused subs and functions.
>
>How do I find then in the source so I can clean up?
>MZ-Tools does not seem to have anything for that or maybe I just do not
>know the terminology.
>
>Anything else out there that will do that? All I need is a list and I
>can do the cleanout.
>

With MZ-Tools you can invoke a Source Code Review
http://www.mztools.com/v3/onlinehelp/index.html?html_review_sourc...
Although as noted this will only work with "Private" declarations.

For "Public" declarations you need to do your clean-up by hand. Simply
do a Project-wide search for each declaration. This is something that
you should be be doing periodically anyway - if you wait - it becomes
a grind.

If you have large block of functions you think are no longer used you
can simply comment out (or conditional directive) the block and then
attempt to make. Make will immediately error if it needs something.

I often use conditional compile directives while developing with
testbed functions. Something like this ...

#Const USE_TESTBED = 1

#If USE_TESTBED Then
Public Function foo() As String
....
End Function
...
#EndIF

Easy to come back later and delete the whole block. And that way I
seldom leave trash behind.

mm

12/3/2011 9:24:00 AM

0

El 02/12/2011 11:16 p.m., BeeJ escribió:
>
> Anything else out there that will do that? All I need is a list and I
> can do the cleanout.

Check Aivosto Project Analyzer: http://www.aivosto.com/project/pr...

I think it does it.

BeeJ

12/5/2011 12:01:00 AM

0

Source Review (I use it) finds unused Dims and such.

I have used

#Const USE_TESTBED = 1

#If USE_TESTBED Then
Public Function foo() As String
....
End Function
...
#EndIF

but put the USE_TESTBED = 1 in the Conditional compile line.

Nice to know about using
#Const USE_TESTBED = 1

What other syntax is available?

e.g. searching Help for #if only finds if. Strange?
searching for "conditional near compile" only finds #if #else #endif

Seems someone should by now have written the XREF for VB6 (feebee).



--- Posted via news://freenews.netfront.net/ - Complaints to news@netfront.net ---

(nobody)

12/5/2011 12:55:00 AM

0

"BeeJ" <nospam@spamnot.com> wrote in message
news:jbh1j6$2fd6$1@adenine.netfront.net...
> Source Review (I use it) finds unused Dims and such.
>
> I have used
>
> #Const USE_TESTBED = 1
>
> #If USE_TESTBED Then
> Public Function foo() As String
> ....
> End Function
> ...
> #EndIF
>
> but put the USE_TESTBED = 1 in the Conditional compile line.
>
> Nice to know about using
> #Const USE_TESTBED = 1
>
> What other syntax is available?
>
> e.g. searching Help for #if only finds if. Strange?
> searching for "conditional near compile" only finds #if #else #endif
>
> Seems someone should by now have written the XREF for VB6 (feebee).

Go to Project properties, Make tab, and at the bottom, check "Conditional
Compilation Arguments". Click the help button for more details. Here they
would apply to the whole project rather than having to use #Const in each
module. For more than one argument, use ":". Example:

USE_TESTBED = 1 : DEMO = 1



Dee Earley

12/5/2011 5:54:00 PM

0

On 03/12/2011 03:51, ralph wrote:
> On Fri, 02 Dec 2011 18:16:17 -0800, BeeJ<nospam@spamnot.com> wrote:
>
>> Unused Subs/Functions
>> I expect that the compiler just ignores unused subs and functions.
>>
>> How do I find then in the source so I can clean up?
>> MZ-Tools does not seem to have anything for that or maybe I just do not
>> know the terminology.
>>
>> Anything else out there that will do that? All I need is a list and I
>> can do the cleanout.
>>
>
> With MZ-Tools you can invoke a Source Code Review
> http://www.mztools.com/v3/onlinehelp/index.html?html_review_sourc...
> Although as noted this will only work with "Private" declarations.
>
> For "Public" declarations you need to do your clean-up by hand. Simply
> do a Project-wide search for each declaration. This is something that
> you should be be doing periodically anyway - if you wait - it becomes
> a grind.

MZTools' Find callers can do this for you and works well for methods.
If you're using it on properties or genericly named members (.enabled,
..add, etc) then it struggles a bit more.

--
Dee Earley (dee.earley@icode.co.uk)
i-Catcher Development Team
http://www.icode.co.uk...

iCode Systems

(Replies direct to my email address will be ignored.
Please reply to the group.)

ralph

12/5/2011 8:12:00 PM

0

On Sun, 4 Dec 2011 19:55:01 -0500, "Nobody" <nobody@nobody.com> wrote:

>"BeeJ" <nospam@spamnot.com> wrote in message
>news:jbh1j6$2fd6$1@adenine.netfront.net...
>> Source Review (I use it) finds unused Dims and such.
>>
>> I have used
>>
>> #Const USE_TESTBED = 1
>>
>> #If USE_TESTBED Then
>> Public Function foo() As String
>> ....
>> End Function
>> ...
>> #EndIF
>>
>> but put the USE_TESTBED = 1 in the Conditional compile line.
>>
>> Nice to know about using
>> #Const USE_TESTBED = 1
>>
>> What other syntax is available?
>>
>> e.g. searching Help for #if only finds if. Strange?
>> searching for "conditional near compile" only finds #if #else #endif
>>
>> Seems someone should by now have written the XREF for VB6 (feebee).
>
>Go to Project properties, Make tab, and at the bottom, check "Conditional
>Compilation Arguments". Click the help button for more details. Here they
>would apply to the whole project rather than having to use #Const in each
>module. For more than one argument, use ":". Example:
>
>USE_TESTBED = 1 : DEMO = 1
>

While noted in the documentation it is often over-looked that the
#Const directive is 'private' to the module in which it appears and
will over-ride any 'public' directive, whether through the project
attributes or command line. Thus a module that contains
#Const DEMO = 0
will not compile any conditional blocked with DEMO within the module
regardless of any public directive.

Because of this I often place this bit of fluff at the top of modules
that contain conditional compiles just to remind myself. <g>

' Use Public directive
'#Const DEMO = 0

-ralph

BeeJ

12/5/2011 11:24:00 PM

0

Deanna Earley pretended :
> On 03/12/2011 03:51, ralph wrote:
>> On Fri, 02 Dec 2011 18:16:17 -0800, BeeJ<nospam@spamnot.com> wrote:
>>
>>> Unused Subs/Functions
>>> I expect that the compiler just ignores unused subs and functions.
>>>
>>> How do I find then in the source so I can clean up?
>>> MZ-Tools does not seem to have anything for that or maybe I just do not
>>> know the terminology.
>>>
>>> Anything else out there that will do that? All I need is a list and I
>>> can do the cleanout.
>>>
>>
>> With MZ-Tools you can invoke a Source Code Review
>> http://www.mztools.com/v3/onlinehelp/index.html?html_review_sourc...
>> Although as noted this will only work with "Private" declarations.
>>
>> For "Public" declarations you need to do your clean-up by hand. Simply
>> do a Project-wide search for each declaration. This is something that
>> you should be be doing periodically anyway - if you wait - it becomes
>> a grind.
>
> MZTools' Find callers can do this for you and works well for methods.
> If you're using it on properties or genericly named members (.enabled, .add,
> etc) then it struggles a bit more.

But that only does it when the cursor in in the sub and not across the
entire source. Or do I not understand.

I found an XREF on planet by Ulli.
Unfortunately it has two failings for my purposes.
1) uses the clipboard badly - fails on many of my apps (but not all)
trying to write the tree when working with the icons. I coded around
it but then ... you don't get the ouput.
2) identifies discrepencies by coloring but you cannot click on the
tree node and get back the code line (has the module line and column
but that is very time consuming).

If I understood Add-Ins better I might try to mod it but alas ...


BeeJ

12/5/2011 11:28:00 PM

0

ralph explained on 12/5/2011 :
> On Sun, 4 Dec 2011 19:55:01 -0500, "Nobody" <nobody@nobody.com> wrote:
>
>> "BeeJ" <nospam@spamnot.com> wrote in message
>> news:jbh1j6$2fd6$1@adenine.netfront.net...
>>> Source Review (I use it) finds unused Dims and such.
>>>
>>> I have used
>>>
>>> #Const USE_TESTBED = 1
>>>
>>> #If USE_TESTBED Then
>>> Public Function foo() As String
>>> ....
>>> End Function
>>> ...
>>> #EndIF
>>>
>>> but put the USE_TESTBED = 1 in the Conditional compile line.
>>>
>>> Nice to know about using
>>> #Const USE_TESTBED = 1
>>>
>>> What other syntax is available?
>>>
>>> e.g. searching Help for #if only finds if. Strange?
>>> searching for "conditional near compile" only finds #if #else #endif
>>>
>>> Seems someone should by now have written the XREF for VB6 (feebee).
>>
>> Go to Project properties, Make tab, and at the bottom, check "Conditional
>> Compilation Arguments". Click the help button for more details. Here they
>> would apply to the whole project rather than having to use #Const in each
>> module. For more than one argument, use ":". Example:
>>
>> USE_TESTBED = 1 : DEMO = 1
>>
>
> While noted in the documentation it is often over-looked that the
> #Const directive is 'private' to the module in which it appears and
> will over-ride any 'public' directive, whether through the project
> attributes or command line. Thus a module that contains
> #Const DEMO = 0
> will not compile any conditional blocked with DEMO within the module
> regardless of any public directive.
>
> Because of this I often place this bit of fluff at the top of modules
> that contain conditional compiles just to remind myself. <g>
>
> ' Use Public directive
> '#Const DEMO = 0
>
> -ralph

good plan.



--- Posted via news://freenews.netfront.net/ - Complaints to news@netfront.net ---

Dee Earley

12/6/2011 10:00:00 AM

0

On 05/12/2011 23:23, BeeJ wrote:
> Deanna Earley pretended :
>> On 03/12/2011 03:51, ralph wrote:
>>> On Fri, 02 Dec 2011 18:16:17 -0800, BeeJ<nospam@spamnot.com> wrote:
>>>> How do I find then in the source so I can clean up?
>>>> MZ-Tools does not seem to have anything for that or maybe I just do not
>>>> know the terminology.
>>>
>>> With MZ-Tools you can invoke a Source Code Review
>>> http://www.mztools.com/v3/onlinehelp/index.html?html_review_sourc...
>>>
>>> Although as noted this will only work with "Private" declarations.
>>>
>>> For "Public" declarations you need to do your clean-up by hand. Simply
>>> do a Project-wide search for each declaration. This is something that
>>> you should be be doing periodically anyway - if you wait - it becomes
>>> a grind.
>>
>> MZTools' Find callers can do this for you and works well for methods.
>> If you're using it on properties or genericly named members (.enabled,
>> .add, etc) then it struggles a bit more.
>
> But that only does it when the cursor in in the sub and not across the
> entire source. Or do I not understand.

Correct, I was only expanding on the "clean up by hand" and "project
wide search".

--
Dee Earley (dee.earley@icode.co.uk)
i-Catcher Development Team
http://www.icode.co.uk...

iCode Systems

(Replies direct to my email address will be ignored.
Please reply to the group.)