473,387 Members | 1,579 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

warn me on unused methods

A nice feature of the csc.exe compiler is that it warns you if a variable is
declared but never used. But unused methods are not flagged, even when the
warning level is set to 4.
Jul 31 '06 #1
9 1720
That suggestion obviously couldn't be applied across the board. But,
I'm having a hard time trying to think of a compelling arguement
against checking private methods for use. Anyone?

Brian

Martijn Mulder wrote:
A nice feature of the csc.exe compiler is that it warns you if a variable is
declared but never used. But unused methods are not flagged, even when the
warning level is set to 4.
Jul 31 '06 #2
The only argument I can think of is to check private methods for use.
However, I honestly don't see this as a very useful feature.

It is very common to have a variable declared and used, then change the
code, and now it is no longer needed.

It's hard to imagine having frequent scenarios of entire methods being
written but never used.

For me, this would be at the very bottom of lists of priorities in terms of
compiler enhancements.

"Brian Gideon" <br*********@yahoo.comwrote in message
news:11**********************@m73g2000cwd.googlegr oups.com...
That suggestion obviously couldn't be applied across the board. But,
I'm having a hard time trying to think of a compelling arguement
against checking private methods for use. Anyone?

Brian

Martijn Mulder wrote:
>A nice feature of the csc.exe compiler is that it warns you if a variable
is
declared but never used. But unused methods are not flagged, even when
the
warning level is set to 4.

Jul 31 '06 #3
My 'bottom-up' approach to programming could certainly benefit from a
compiler that warns for unused private methods. I write very much very small
private methods, one, two, sometimes three lines long, that I assemble into
bigger chunks. The good old 'Lego' approach. It is what makes programming
fun to me. But when I finally have the functionality that I wish, many many
of these methods have no use. The 'weeding' of the code is also fun, all
those hours work and now I throw it away! I enter 'Zen' mode and use a
two-step approach: 1) comment out what might be useless by now and try to
compile; 2) restore the code if compilation fails, otherwise delete it.

You understand that a list of unused private methods would help.

"Marina Levit [MVP]" <so*****@nospam.comschreef in bericht
news:eI**************@TK2MSFTNGP04.phx.gbl...
The only argument I can think of is to check private methods for use.
However, I honestly don't see this as a very useful feature.

It is very common to have a variable declared and used, then change the
code, and now it is no longer needed.

It's hard to imagine having frequent scenarios of entire methods being
written but never used.

For me, this would be at the very bottom of lists of priorities in terms
of compiler enhancements.

"Brian Gideon" <br*********@yahoo.comwrote in message
news:11**********************@m73g2000cwd.googlegr oups.com...
>That suggestion obviously couldn't be applied across the board. But,
I'm having a hard time trying to think of a compelling arguement
against checking private methods for use. Anyone?

Brian

Martijn Mulder wrote:
>>A nice feature of the csc.exe compiler is that it warns you if a
variable is
declared but never used. But unused methods are not flagged, even when
the
warning level is set to 4.


Jul 31 '06 #4
Hello Martijn,

And what's the problem? Do u want to find unused methods or what?
There 2 two solutions
1) use ReSharpert tool - it shows in gray collor unused methods
2) use NCover tool - this tool shows which function was called during run
programs. If you have good unitTests then after running all tests with NCover
u will see which functions were untouched

MMA nice feature of the csc.exe compiler is that it warns you if a
MMvariable is declared but never used. But unused methods are not
MMflagged, even when the warning level is set to 4.
MM>
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
Jul 31 '06 #5
The problem is that I use 2 sharp tools, an editor (vim.exe) and a compiler
(csc.exe) and that I'm not really interested in learning new tools where a
simple compiler switch could suffice
MN And what's the problem? Do u want to find unused methods or what?
MNThere 2 two solutions
MN1) use ReSharpert tool - it shows in gray collor unused methods
MN2) use NCover tool - this tool shows which function was called during
run
MNprograms. If you have good unitTests then after running all tests with
NCover
MN u will see which functions were untouched

MMA nice feature of the csc.exe compiler is that it warns you if a
MMvariable is declared but never used. But unused methods are not
MMflagged, even when the warning level is set to 4.
MM>
Jul 31 '06 #6
Hello Martijn,

I suppose such tools like nUnit and NCover are worth being learned :)

MMThe problem is that I use 2 sharp tools, an editor (vim.exe) and a
MMcompiler (csc.exe) and that I'm not really interested in learning
MMnew tools where a simple compiler switch could suffice
MM>
MN>And what's the problem? Do u want to find unused methods or what?
MN>There 2 two solutions
MN>1) use ReSharpert tool - it shows in gray collor unused methods
MN>2) use NCover tool - this tool shows which function was called
MN>during
MMrun
MN>programs. If you have good unitTests then after running all tests
MN>with
MN>>
MMNCover
MN>u will see which functions were untouched
MN>>
MM>A nice feature of the csc.exe compiler is that it warns you if a
MM>variable is declared but never used. But unused methods are not
MM>flagged, even when the warning level is set to 4.
MM>>
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
Jul 31 '06 #7
Michael, I never touched a debugger in my life. They scare the hell out of
me ;-)

Hello Martijn,

I suppose such tools like nUnit and NCover are worth being learned :)

MMThe problem is that I use 2 sharp tools, an editor (vim.exe) and a
MMcompiler (csc.exe) and that I'm not really interested in learning
MMnew tools where a simple compiler switch could suffice
MMMN>And what's the problem? Do u want to find unused methods or what?
MN>There 2 two solutions
MN>1) use ReSharpert tool - it shows in gray collor unused methods
MN>2) use NCover tool - this tool shows which function was called
MN>during
MMrun
MN>programs. If you have good unitTests then after running all tests
MN>with
MN>MMNCover
MN>u will see which functions were untouched
MN>MM>A nice feature of the csc.exe compiler is that it warns you if a
MM>variable is declared but never used. But unused methods are not
MM>flagged, even when the warning level is set to 4.
MM>---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do
not cease to be insipid." (c) Friedrich Nietzsche


Jul 31 '06 #8
Hello Martijn,

These tools are not debuggers, they only help to make you code more perfect
:)

MMMichael, I never touched a debugger in my life. They scare the hell
MMout of me ;-)
MM>
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
Jul 31 '06 #9
Hello Michael,

I am terribly sceptic about things. Anti wrinkle cream, it will give you
wrinkles. Debuggers, they introduce bugs. Code streamliners, sure to break
your code. But you seem like a nice person to me so I will investigate the
tools that you recommend. Thanks for your time
MNThese tools are not debuggers, they only help to MNmake you code more
perfect
:)

MMMichael, I never touched a debugger in my life. They scare the hell
MMout of me ;-)
MM>
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche

Jul 31 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: artooro | last post by:
Hi, I'm using some lines of code like this: ClassName *var = new ClassName(...); and that's it. The class constructor does everything I want (there are methods to do more but I don't need...
11
by: Michael B Allen | last post by:
Is there a standard method for supressing warnings regarding unused parameters? I have a function that might be called hundreds of thousands of times that looks like this: const void *...
12
by: zacks | last post by:
Suddenly, in a VB2005 project I am working on, several variables show up in the list of warnings are being unused local variables. But they all are. Several of them are the ex variable used in a...
9
by: ThazKool | last post by:
I am just wondering if all the methods that are never called upon during a programs execution are removed when optimizing. For example you have: class FooA { void a(); ... void z(); }
5
by: Jake K | last post by:
In VStudio 2005 is there an easy way to find unused methods? I have a application that has been restructures several times and I would like toremove any methos that is not used.
8
by: Frank Rizzo | last post by:
Is there a setting in VS2005 to quickly locate methods that are unused (maybe through compiler warnings)? If not, any utilities out there that do that? Thanks
4
by: Rob Meade | last post by:
Hi all, I'm using Visual Studio 2005 and it has as you are probably aware a very handy feature of reporting to you which variables are not being used - cool thanks... What would be even more...
0
by: Fabian Wein | last post by:
Hi, I hope this is not too off-topic! Is there a free tool that scans for unused methods? Maybe a (gnu) linker option? Thanks, Fabian
2
by: Ming | last post by:
Hi folks, Is there a handy tool to find which methods are not used at all in a php project? Thanks,
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.