Review Dead Code

Top  Previous  Next

The Review Dead Code feature allows you to review the source code to detect some unused declarations (constants, variables, parameters, procedures, etc.).

MZ-Tools offers the following ways to review dead code:

  • The MZ-Tools | Other Utilities | Review Dead Code... menu.
  • The Other Utilities | Review Dead Code... menu on the MZ-Tools toolbar.
  • The keyboard shortcut associated with the MZTools6_VSXXXX.ReviewDeadCode command.

When you invoke this feature, a dialog window is shown that allows you to select the scope of the operation. The results are shown in a Result Window.

This review can be launched automatically (or you can be asked) before a build in Release configuration. This is customizable in the Corporate Options window, Review Dead Code section. If dead code is detected, the Result window keeps open (otherwise it is closed). You should remove the dead code before building the executable.

Remarks:

  • Ensure that the source code can be compiled without errors before running this feature.
  • This feature works searching occurrences of a declaration in the source code, but it does not check that the occurrence really belongs to the declaration. This implies that there are some limitations; for example, if you have two overloaded procedures, one used and another unused, the feature will be unable to report the unused overloaded procedure because its name is used in the source code and the number and type of parameters of the call is not checked.
  • For performance reasons, this review checks only private declarations, that is, declarations that can be used only inside the code element where they are declared.
  • Procedure variables and constants are reviewed only for the VB.NET language.
  • This feature is not available for the C++ language.

See Also:

Result Window

Review Dead Code Options

Keyboard Shortcuts Options