VDF-GUIdance logo

  Visual DataFlex Logo

Shared knowledge leads to accumulated knowledge

        Printer Friendly Page

Unused Variables

by Bob Worsley


This is a tool to check source code for local variables that have been delared but not used. It can either be run as a standalone application or since the subroutine that does the work is a class, it can be used in other applications.
Size: 20 KB Download
Date Created: 11/03/2008
Date Updated: 03/10/2017
Author: Bob Worsley

2017-10-01 Unused Variables ~ 949KB

Unused Variable Checking

Extra local variables are always created in the normal development process especially
during a rewrite of an older program. By themselves they don't really harm anything,
but can sometimes be confusing to the developer.

The goal of this program is to either show or output any unused variables to a log file.
A workspace selector isn't provided, operation is thought to be one of the following:
1. Run from the tools menu in the Studio or the Hammer
2. Copy the executable to the programs directory of the workspace where you want to check source
3. Simply use the file dialog to find the source you want.

Output will be to an edit object in the view or if file output is selected, then the log will be written to the directory where the source is being checked.

A registry entry will be written that lets the program "remember" the last directory
that was worked in.

Two outside packages are used, vWin32fh.pkg library from vdf-Guidance, and the StringTokenizer
by Torkild Resheim. The StringTokenizer is provided with this application, vWin32fh
is not because it's an evolving package and you should obtain the latest from vdf-Guidance.
There will be some conditions or variable types that haven't been included
or thought of, so let the author know if so. Usually this will show up as a missing method name
or blank variable name. And usually it's a simple answer - another trim necessary, or
a comparison that requires an extra space somewhere.

Bob Worsley


2008-04-12 Fixed a few bugs, made it into a class so it is easier to incorporate in other apps and made a few minor adjustments.
2017-08-20 Replaced the showln output box with an edit object in the view and added command line functionality for potential use in the Studio or the Hammer. In addition this workspace now uses the vWin32fh library available here in vdf-Guidance.com
2017-08-26 Added a "batch" function that will process all source files in an entire folder at one time. Added a help file & button.
2017-10-01 Added the ability to actually remove unused variables from the source code in single or batch mode. Updated source is written to a different directory


2017-10-01 Unused Variables ~ 949 kB
2017-08-26 Unused Variables ~ 22kB
2017-08-21 Unused Variables ~22 kB
2008-04-14 Unused Variables ~ 20 kB
2008-03-11 Unused Variables ~ 58 kB

Subversion repository

This project is under version control using subversion software.
The URL for the project is: