Watcom C/C++ Gets a New FaceVersion 10.0 delivers a graphical development environment and an impressive cross-platform solution
Rick GrehanWatcom C/C++, already a formidable compiler, has become even more impressive in its new version, 10.0. Die-hard Watcom users will be happy to know that Watcom hasn't reduced its compiler's cross-platform capabilities; if anything, they've been enhanced. And possibly the biggest crack in the Watcom C/C++ edifice, its lack of any graphical development environment, has been plastered shut.
Watcom's C/C++ compilers were always solidly built products. When BYTE last did a C++ compiler roundup (``C++ Does Windows,'' September 1993), Watcom's 32-bit C/C++ 9.0 generated some of the best-performing code on the benchmarks we used. Even back then, Watcom was producing an ANSI-compliant C++ compiler with full support for templates and exceptions. Those strengths, along with the compiler's ability to produce executable files for so many targets, made it a valuable development system for anyone creating cross-platform applications.
As You Like It
Watcom C/C++ 10.0 is even more of a chameleon than its predecessors. You can run Watcom on DOS (command-line), OS/2 2.x, Windows 3.x, or Windows NT. From any of the host platforms, you can generate executables for DOS, Windows 3.x, OS/2 1.x and 2.x, NT, Novell NetWare, and AutoCAD. I ran Watcom hosted on a 66-MHz 486DX2 running Windows for Workgroups 3.11.
In the past, Watcom released its 16- and 32-bit compilers as separate products. Not so with version 10.0: From a single host, you can produce both 16- and 32-bit code. The bundled DOS4G/W from Rational Systems lets you create 32-bit DOS-extender applications up to 32 MB in size (you can distribute the applications royalty-free). On the Windows side, you can create either Win32s applications or, using a kind of Windows 32-bit extender unique to the Watcom compiler, 32-bit Windows applications that can run under Windows 3.x without using Win32s. (Such an application can run under Windows 3.x as well as in a WinOS/2 session under OS/2.)
I'm still not finished listing Watcom's output formats, because within each target platform you can select among a variety of deliverables. For example, under 32-bit DOS you can create executables for the DOS4GW extender, PharLap's extenders (TNT and 386DOS), the FlashTek extender, or a library file. The full list would take more room than I have here.
What You See
Watcom C/C++ 10.0's most visible addition is its suite of graphical development tools. This is good news on the one hand, because--like it or not--compilers in the PC realm are often judged more on the basis of their GUI development environments and less on the technical strength of their compiler cores. New users' first impressions of Watcom C/C++ 10.0 will certainly be better than with C/C++ 9.0. On the other hand, it's not-so-good news for those of us who appreciated that we could install Watcom in a reasonable amount of time and disk space. GUI-based C/C++ development systems are becoming legendary disk-space consumers, and Watcom's 10.0 won't be left out of that lore.
Watcom C/C++ 10.0 arrives on a CD-ROM. A full installation will annex over 170 MB of disk space. You can significantly reduce this requirement if you install a subset of all potential target platforms. You can reduce it even more if you opt, as I did, to keep the help files on the CD-ROM. Unfortunately, I paid a price for such disk-space reduction tactics. In particular, the development tools search for their help files in the local directory, so the help entry on all tools menus simply responded with a ``Cannot open help file'' error. I had to access the help files from their individual icons on the desktop.
Watcom's IDE (integrated development environment) and other graphical development tools are so nice, however, that I quickly overcame my disk space anxieties. If you've worked with earlier versions of Watcom C/C++ and you're like me, then you've built up collections of make files or compiler/linker batch-file templates. In defense of Watcom 9.0, it wasn't a difficult arrangement to live with: When I was developing several 32-bit command-line-driven programs, I could create DOS extended, NT, or OS/2 versions by just executing the appropriate link batch file; recompilation was unnecessary.
The Project Paradigm
Watcom C/C++ 10.0 makes life even easier; I don't need those batch files anymore. Watcom 10.0's IDE is built around the now-ubiquitous project paradigm. A project is a collection of one or more targets, a target being the final result of a compilation--.exe, .com, and .lib files are examples. In turn, a target is composed of sources--usually header, C, or C++ source files, but they can also be resource files, libraries, bit maps, and so on.
Once you create a new project, you begin building a target by populating the subwindow with sources. The IDE examines source file extensions and gathers files accordingly, placing those with the same extension into folders within the target subwindow. So, all .c files go into one folder, all .bmp files into another, and so on. You can close or open folders in a manner similar to the directory representation you find in the Windows File Manager.
This provides better control over the many tools that work together to build the final application. You don't have to remember which compiler to unleash on which source file (e.g., C compiler for .c files, C++ compiler for .cpp files, and resource compiler for .rc files), nor do you have to worry about deducing file dependencies; the IDE does all the worrying for you. Often, you don't even need to know which compiler switches to set. Simply put, Watcom's IDE makes your make files for you. (If you enjoy operating the compiler, linker, and so on from the command line, you can still do that.)
Furthermore, if you double-click on a .c or .cpp filename in the target subwindow, the IDE launches Watcom's editor for Windows and loads it with the source file. Likewise, if you double-click on a .bmp file, you are whisked to Watcom's image editor, and the bit map is loaded automatically. (I'm describing the IDE from the perspective of a Windows user. There are some differences depending on which platform you use as the host development system. For example, if you're running OS/2 2.x, double-clicking on a resource file will launch IBM's resource editor.)
Watcom's IDE also makes use of the right mouse button to launch context-sensitive pop-up menus. For example, when you right-click on a source's filename in the target subwindow, the IDE summons a pop-up menu that provides access specific to that source file. If it is a C or C++ source file, the pop-up menu lets you modify the file's unique set of compiler switches. In this way, you can have some source files compiled, say, for speed, while others are compiled optimized for size. Another selection from the pop-up menu presents a pick list of all include files; double-click on one, and it's off to the editor again.
Browser and Assembler
Many of Watcom C/C++ 10.0's tools were already available in earlier versions of the compiler package. These include the heap walker, the spy, a spy for DDE events, and the Dr. Watcom crash-analysis tool (although now there's also a Dr. Watcom NT). Some tools, however, are brand-new to 10.0.
The C++ compiler now includes a class browser. Perhaps it's improper of me to ascribe the browser to the compiler; I do so because it's the compiler that (based on a switch setting) emits the database that the browser reads.
Opening the browser reveals a graphical flowchart view that shows inheritance hierarchy. When you double-click on one of the graph members, a dialog box pops up, showing in a scrollable list all member functions and instance variables of that class. Everything is thoughtfully grouped into public, private, or protected areas. Clicking with the right mouse button in this dialog box opens yet another pop-up menu; this one offers to ferry you to the source code where the class is defined (again, by launching the Watcom editor and auto-loading the file) or provide a list of all locations in the source code where the particular class is referenced.
Then there's the Watcom assembler, WASM. WASM is Microsoft-compatible and handles all PC-based Intel processors from the 8086 up to the Pentium. Unfortunately, I was unable to completely investigate all the details of the assembler. Its help file had a bug in it that caused a system error whenever I scrolled past a certain point. When I reported the bug, it turned out that the people at Watcom were already aware of it. A corrected version of the file was available from Watcom's BBS, free for the downloading. But since I was running my help files from the CD-ROM, my choices were to download the file and redirect the help-file icon to the new file on disk, try to guess my way through the assembler, or wait for a new CD-ROM. Since most of my work was with C/C++ code, I opted for the last choice.
Debugger and Profiler
Watcom's debugger has a redesigned, configurable interface. Graphics-mode versions of the debugger exist for OS/2 2.x, Windows 3.x, and NT; you can run a character-mode version under DOS, as well as under the operating systems mentioned above. New features in the debugger include a replay capability: Depending on how much memory you have available, the debugger allows you to step back in time, actually undoing the effects of instructions as you go.
You can also unwind the stack. This capability lets you step up and down through the nested hierarchy of calling routines. Local variables are updated accordingly, so no matter what level you're at, you're always seeing a correct view of the local environment. And if you enjoyed the extensive programmability of Watcom's previous debugger, Video, you'll be glad to know Watcom has carried the command-line capabilities into the new debugger.
Finally, code-tuning freaks will enjoy Watcom's new profiler. This tool is actually two components, a sampler and a profiler. You run your application within the sampler, which collects statistics of the execution and deposits the results in a file. When execution is complete, you enter the profiler to explore the results.
The profiler works pretty much the way you'd expect. You're given a window that lists the modules within your program. Double-click on a module name, and you step down a level in detail. At each level, bar graphs appear adjacent to each item within a module, indicating relative and absolute time spent in that item. You can continue this stepping-down process to the assembly language level. At this point, the results of the sampler become almost meaningless, since on most 486 or Pentium systems, a lot of instructions will be executing within a millisecond--beyond the accuracy of the sampler's clock.
Yet More
Additional gimmees with the Watcom compiler are not visual, but hard-core developers will find them invaluable. First, there's support for MFC (Microsoft Foundation Classes) 2.5 (for building 16-bit applications under Windows 3.x) and MFC 2.1 (for building 32-bit applications under Win32s or NT). Next, Watcom has licensed components of the OS/2 2.1, Windows 3.1, and NT toolkits. Specifically, these components amount to API libraries and on-line help. The compiler also comes with all the header and import files you need to build an NLM (NetWare loadable module), and it's bundled with components from SOBObject's developer's toolkit for OS/2.
After I've sounded so enthusiastic about the Watcom C/C++ compiler's new look, here's a quick dose of perspective. Users of similar Borland, Symantec, or Microsoft products can reasonably ask: ``What's the big deal? We've been using graphical development tools for years now.'' All I can do is hope that the programming energy Watcom diverted into the GUI building doesn't reduce the capability of the compiler itself. As new versions of compilers from Microsoft, Symantec, and Borland become available, BYTE will do comparative tests of the quality of generated code.
Also, I did log a number of bugs in various IDE components. The source code browser appeared confounded about just where in the code a given class definition appeared. It seemed to think that a ``friend class
'' declaration was the actual class definition. And sometimes edit boxes in one of the compiler switch dialog boxes failed to appear; I would have to shut down the IDE and restart to get them to show up. The Watcom package has no C or C++ language manuals, so novice C programmers should beware. Even for seasoned programmers, I'm not sure how convenient it is to have supporting documentation in the form of help files.
One thing this package needs is a cumulative index. It's often a real spelunking job figuring out in which file hides the answer to a particular question. That said, I must mention that, if you'd rather have your documentation in paper form, Watcom will make it available to you at extra cost (currently $120 purchased separately). The additional fee also gets you Bjarne Stroustrup's C++ Programming Language (possibly the best reference work for the C++ language) and a C language guide.
In spite of the above caveats, I've had so much good experience in the past with Watcom products that I am optimistic that the company will be able to iron out the wrinkles. Watcom C/C++ has always been a top choice for a multiplatform compiler, and 10.0 looks like another winner.
The Facts
Watcom C/C++ CD-ROM system $350 CD-ROM plus all paper documentation $450 Paper documentation separately $120 Significant educational discounts are available; contact Watcom for details. Watcom International Corp. 415 Phillip St. Waterloo, Ontario, Canada N2L 3X2 (519) 886-3700 fax: (519) 747-4971
Illustration: The Watcom IDE, showing the open dialog box holding the sources for a sample target. Note the icon for another target on the left (a single project can have multiple targets). The IDE groups sources within a target into logical folders. A pop-up menu appears to the right of the selected source; this menu lets you manipulate, delete, or make the selected source, or add a new source.
Illustration: The new class browser, showing inheritance hierarchy. When you double-click on a class name, a dialog box appears, listing all member functions and instance variables.
Illustration: Watcom's resource editor, with the menu editor window launched, having excised the menu bar from the Windows solitaire game.
Rick Grehan is technical director of the BYTE Lab. Before coming to BYTE, he worked as a professional programmer. He has a B.S. in physics and applied mathematics and an M.S. in mathematics/computer science. You can reach him on the Internet or BIX at rick_g@bix.com.




Copyright © 1994-1997