Solved

How to detect unused variables?

Posted on 2000-02-15
6
899 Views
Last Modified: 2008-03-03
Hello experts.
I have 2 questions:

1: I remember when I compile C programs using cc compiler it tells me whether I have un-used variables.

Is there a similar thing in VB?

2: I sometimes declare variables without a viariable type ie..

dim aString
dim aInt


which will set the variables to type Variant.

When i do this, it would be by mistake, is there a way to get the compiler to tell me this?


Thanks


Kaiser

0
Comment
Question by:kaiser18au
  • 2
  • 2
  • 2
6 Comments
 
LVL 13

Expert Comment

by:Mirkwood
ID: 2525240
See the tools here. They are free and Project Analyzer has the feature of detecting unused variables and mismatches like your example. http://www.aivosto.com/visdev/
0
 

Author Comment

by:kaiser18au
ID: 2528991
Mirkwood:

Thanks for the answer. I checked out the website and
it was good. But the only had solutions to Q1.

If you dont mind I would like to keep this question open to see if people have suggestions for Q2.


If there is nothing else, then you could have the points.


Regards


kaiser
0
 
LVL 6

Expert Comment

by:VBGuru
ID: 2530285
Q2. There is no way a compiler can do this. Compiler will check for the syntax and as per the syntax it is a valid. So it will continue without any problem.

You can take a precaution using
DefBool DefByte DefInt DefLng DefCur
DefSng DefDbl DefDec DefDate DefStr ...

May be you cam write an add-in to check for these kind of declarations
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
LVL 6

Expert Comment

by:VBGuru
ID: 2530286
Q2. There is no way a compiler can do this. Compiler will check for the syntax and as per the syntax it is a valid. So it will continue without any problem.

You can take a precaution using
DefBool DefByte DefInt DefLng DefCur
DefSng DefDbl DefDec DefDate DefStr ...

May be you cam write an add-in to check for these kind of declarations
0
 

Author Comment

by:kaiser18au
ID: 2532848
Mirkwood:

Sorry about that, that websites software did have that feature.

If you want to put in another answer, then I can forward you the points.

It was just a feature that was hidden, you had to pop up the options thats all.

Thaks again.

kaiser
0
 
LVL 13

Accepted Solution

by:
Mirkwood earned 20 total points
ID: 2537059
Ok, thanks
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

708 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now