HOME
PRODUCTS
  Insure
  WebKing
  Jtest
  Jcontract
  CodeWizard
  C++Test
SUPPORT
PAPERS
ABOUT
WHAT'S NEW
EVENTS

Parasoft Tools that Debug




CodeWizard

By Al Stevens


I recently received a review copy of a product named CodeWizard from ParaSoft Corp. (). CodeWizard is an interesting product that performs diagnostic analysis of C++ source code. The Windows 95 version installs into the Visual C++ Developer Studio and analyzes the C++ code in a Developer Studio project. That is the version I tested. There are also command-line versions of CodeWizard for Alpha, HP, Linux, RS/6000, SCO, SGI, Solaris, and SunOS.

What makes CodeWizard interesting is that its diagnostic checks are based on the C++ programming guidelines documented by Scott Meyers in his books, Effective C++ and its sequel, More Effective C++, both published by Addison-Wesley. The product package includes copies of the books. Effective C++ is now available in a second edition, but the review copy sent to me had the first edition, probably because the newer edition was only recently released.

In the interest of accuracy I should emphasize that Scott neither endorses nor disapproves of CodeWizard nor does he have any vested interest in its success other than whatever royalties he earns on the books that ParaSoft includes with the product. Scott says, "I endorse the idea of the product, and I encourage people to try it and others like it."

The two books describe 85 individual guidelines for writing robust C++ programs. CodeWizard parses the code to find violations of many of these guidelines. I did not attempt to run a comprehensive test to see which of the guidelines CodeWizard tests and which it does not. That would involve writing programs with 85 violations, and I don't see the point in that. Instead, I did what any programmer would do-I ran CodeWizard against several of my Visual C++ products to see of it could catch any bad habits. This might not be as exhaustive a test as a reviewer should make, particularly since my code has been influenced by Scott's work for several years, and I intuitively avoid many of the violations that CodeWizard would catch. Nonetheless, I decided that if CodeWizard uncovered any bad habits creeping into my programming, it would earn its keep and my endorsement. It did. I found it to be quite effective in many ways. In one respect, CodeWizard is like a periodic test flight for a pilot in that it reveals subconsciously acquired bad work habits. In another, it's like a word-processor's grammar checker in that it calls attention to practices that might be okay in some cases but that need to be looked at in others.

The Visual C++ version of CodeWizard is new and is based in earlier versions that support UNIX platforms. The manuals that came with the review copy does not even mention a Windows version. CodeWizard's integration with Developer Studio is well implemented, however. CodeWizard commands appear on the Tools menu, and its output is written to three new tabbed text displays that are added to Developer Studio's Output window. The only indication of a hasty port is the unnecessary console window that displays when you open the CodeWizard Control Panel. I suspect the window will go away in future versions.

Many of the violations in my projects were found in code that Developer Studio's wizards generate. One such violation that appears consistently is the use of old-style casts. Microsoft's wizards are a little behind the time, it seems. A control panel allows you to suppress certain diagnostics and to bypass selected files. There's no point in parsing all the compiler's header files, for example, and the default is to bypass them. You might be tempted to suppress some warnings, particularly the ones about wizard-generated code, but I prefer to leave them all on. Every now and then a warning points me to a rule that I have forgotten and I am grateful for the reminder.

My only criticism of CodeWizard has to do with persistence, and it's a common problem with makefile-driven tools. CodeWizard's installation procedure adds commands to Developer Studio's Tools menu. One of those commands analyzes all files in the project, except, of course, suppressed files. This procedure launches CodeWizard in independent executions to analyze each file as listed in the makefile. Successive executions, however, do not remember which header files have already have already been parsed and reported in the current analysis run, so violation messages for a header file are repeated for the analysis of every .cpp file that includes that header file. It should be a simple matter to record somewhere which header files have been analyzed and suppress repetitious reports of its violations. Repeated analysis of the header files are necessary in order to provide context for the analysis of .cpp files, but repeated display of the messages is not only unnecessary, it's annoying. To be fair, I should add that I have add that I have the same criticism of most compiler environments, including Visual C++.

CodeWizard is slow. It takes a long time to analyze a project. That in itself is not big problem because you won't run CodeWizard every day against a project. But, to address the issue of performance, ParaSoft is working on precompiled header-file logic to speed up the analysis. Perhaps at the same time they will add code to suppress duplicate warnings.

My only complaint is the name. I don't know which product came first, but a few months ago, I reported a compiler product named CodeWarrior and that name stuck in my head. While writing this column, I kept typing CodeWarrior where I meant CodeWizard. Now I have to look at the boxes to see which product has which name. This is the kind of confusion that makes trademark lawyers happy.

These few criticisms are minor. On the whole, CodeWizard is a useful and valuable tool. It automates the wisdom that Scott Meyers teaches and has the potential of making better programmers out of most of us. I highly recommend it.

This review appeared in an article titled "C3: Conferences, CodeWizard, Committees" in the January 1998 edition of Dr. Dobb's Journal.

Tools to debug c++ and java
(888) 305-0041 info@parasoft.com Copyright © 1996-2001 ParaSoft