Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:

Advanced C 1992

.pdf
Скачиваний:
96
Добавлен:
17.08.2013
Размер:
4.28 Mб
Скачать

Part IV • Documenting the Differences

676

CThe ASCIICharacter SetCC C C

C7C C

A C C C

C C C

C C C

The ASCII

Character Set

679

Part V • Appendixes

Table A.1. The ASCII Character Set

680

CCompilerCVariationsCC C C

CBC C

B C C C

C C C

C C C

Compiler Variations

This appendix reviews four popular C compilers for the PC. Each compiler enables you to compile ANSI C programs, and each offers enhancements as well. Though all share a number of common enhancements, no one compiler offers everything.

These products are covered in alphabetical order by their supplier. This is not a critical review of these compilers; my intent is to simply discuss the features and possible shortcomings of each product.

I use all four of these products; however, it is impossible for me to be fully conversant on all features and parts of these products. All are versatile products, providing many features and utility programs. If I’ve not covered something regarding any of the compilers, I apologize.

Borland also offers entry-level Windows-based development systems in Turbo C++ for Windows and Turbo C++ for DOS. I do not have these products, so I cannot comment on them, but both products have received good reviews in magazines and should serve you well.

681

Part V • Appendixes

Borland’s C++ 3.1

It’s big! This compiler requires about 50M hard disk space and a reinforced bookshelf to hold the documentation. Borland, in creating its premiere C++ compiler, made one of its nicest products yet.

This product fully supports both DOS and Windows development environments. Generally, you can develop applications for the same environment in which the IDE (integrated development environment) is running; I’d recommend using the Windows version—it’s a slick, easy to use IDE.

With its EasyWin program, Borland C++ can migrate a character-based DOS application to Windows by creating a single window that serves for the screen. This window displays both STDOUT and STDERR, while the STDIN input comes from the keyboard. The appearance of these applications is good; however, the application does not have a menu bar. Borland C++ determines the type of application by analyzing the main() function—if it has a main() function, the application is a DOS application and will be built as an EasyWin program; if it has a WinMain() function, it is a Windows program.

You can reduce disk storage requirements by installing only the system parts you plan to use and leaving out some components, such as sample code, library source, and Windows specific components. Not everyone wants to develop Windows programs. However, Windows is becoming a popular environment for programmers who want to create applications with slick user interfaces.

Some of the most significant features of the Borland C++ 3.1 compiler include:

Powerful and slick Windows IDE for programmers who develop Windows software.

Competent DOS-based IDE, offering many features the Windows IDE offers (although you can’t cut and paste from other applications, as you can with Windows).

For Windows developers, Borland offers the Workshop. This program enables you to modify the resources of existing applications, such as dialog boxes, menus, icons, cursors, and bitmaps. The Workshop is powerful: you don’t need the source code for the program you are modifying. You can change applications you didn’t write—modifying that menu you don’t like or that awkward dialog box because it works on an .EXE file. You can, of course,

682

Compiler Variations

C C C

 

CBC

 

C C C

 

C

develop your own application’s resources using Workshop. This one program replaces Microsoft’s DIALOG and IMAGEDIT programs, while adding many new features.

For Windows developers, Borland offers a powerful window-monitoring facility. It lists, in a listbox, all existing windows and their relationships. This feature is much more flexible than Microsoft’s SPY (which requires you to hunt for a given window). After you select a window, you can monitor the messages passed to and from it.

For Windows developers, Borland offers an import library generation tool. This program works much like Microsoft’s IMPLIB program, but runs under Windows. You use an import library tool to develop .DLL (dynamic link library) files.

For Windows developers, Borland offers Turbo Debugger for Windows. This debugger has many powerful features such as remote debugging, dual monitor use, and network-based debugging.

For Windows developers, Borland offers a source code profiler. This profiler is useful for determining which parts of an application consume the most CPU resources. It is tuned for Windows applications.

For Windows developers, Borland offers a UAE monitor (much like Microsoft’s Dr. Watson). This program, which runs constantly, traps hardware exceptions generated by some types of programming errors and creates a log file of information you can use to help debug the application.

For Windows developers, Borland offers a file conversion utility to convert OEM characters to ANSI. This program helps make files created under DOS that have special characters Windows compatible, without a long conversion edit session.

For Windows developers, Borland offers a hot spot editor. This utility is from Microsoft and is the standard Windows SDK hot spot editor.

Borland’s C++ 3.1 offers precompiled headers. A flexible implementation, precompiled headers help speed up the creation (compilation) of large, multisource file projects.

Besides the various programs, an extensive online help system is provided. Online help is becoming increasingly important because the documentation for many compilers (including Borland’s) often exceeds 10,000 pages.

683

Part V • Appendixes

When managing large projects, a make facility is necessary. Borland’s compiler offers both the IDE’s make facility and a stand-alone make that you can run under DOS.

When used under Windows, Borland C++ creates a program group like the one shown in Figure B.1. This group gives you access to each of the features Borland’s C++ offers to the Windows programmer.

DOS IDE

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Resource

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Workshop

 

 

 

 

 

 

 

 

Windows IDE

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Spy on

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Windows

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

messages

Execution

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Turbo

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

debugger

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

profiler

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

(for Windows)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

UAE monitor

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Convert files

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

to various

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

character set

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Help files

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Figure B.1. Borland’s C++ Group under Windows.

When you start the IDE under Windows, you get an attractive application that enables you to do the following:

Define what files make up the application.

Define the application’s attributes (for example, whether it is a Windows application or a DLL).

Edit the application’s files.

Compile and link the application.

Debug and run the application.

684

Compiler Variations

C C C

 

CBC

 

C C C

 

C

Various configuration options control the environment, compiler and linker options, and project options. Borland’s C++ IDE (under Windows) is shown in Figure B.2. Borland’s C++ IDE under DOS is shown in Figure B.3.

Figure B.2. Borland’s C++ IDE under Windows.

Notice the similarity between the IDE under DOS and the IDE under Windows. The main difference is the lack of the push-button toolbar under DOS. In the Windows IDE, it is found just under the menu structure. Under the DOS IDE, the lack of this toolbar isn’t a major problem for most programmers because the functions in the toolbar are available as menu functions.

A shortcoming of the Borland products is they produce only 16-bit code. Hopefully, Borland will soon make a 32-bit code-generating compiler.

Generally, Borland’s C++ compilers are well designed and are a pleasure to use, especially under Windows.

685

Part V • Appendixes

Figure B.3. Borland’s C++ IDE under DOS.

Microsoft

Microsoft currently markets two C compilers. Their main product, C/C++ V7.0, is massive. It has documentation for C, C++, and Windows, and requires a large amount of disk space.

Microsoft’s entry-level compiler, QuickC for Windows, is similar to Microsoft C 6.00. QuickC for Windows currently supports only Windows 3.0.

C/C++ 7.0

Microsoft’s mainline C compiler supports C++ and has a number of new features including incorporation of the Windows SDK with Version 7.0. This compiler is certainly technically competent, but some of its features lag behind the competition.

For one thing, although Microsoft’s compiler probably produces the best compiled code—having extensive optimizations and a long track record as a trustworthy compiler—it offers only a DOS-based IDE. The creators of Windows still haven’t created a true, top-of-the-line Windows development system, which could be viewed as a serious omission.

686

Compiler Variations

C C C

 

CBC

 

C C C

 

C

Some of the notable features of Microsoft’s C/C++ 7.0 include the following:

Competent DOS-based IDE with many of the same features that are offered by QuickC for Windows IDE. You must still use a DOS window to create and compile your Windows applications.

For Windows developers, Microsoft offers a series of programs to develop a Windows program’s resources. These programs enable you to modify the resources (objects such as dialog boxes, menus, icons, cursors, and bitmaps) of applications you’re developing. These programs include Microsoft’s DIALOG and IMAGEDIT.

For Windows developers, Microsoft offers a window-monitoring facility called SPY. After selecting a window, you can monitor the messages passed to and from it, sending the output from SPY to either a window, a file, or the debugging terminal if one is attached to COM1.

For Windows developers, Microsoft offers an import library generation tool. You use an import library tool to develop .DLL files.

For Windows developers, Microsoft offers CodeView 4.0, a competent debugger for Windows. This debugger has many powerful debugging services, such as remote debugging and dual monitor use.

For Windows developers, Microsoft offers a source code profiler, a useful tool in determining which parts of an application consume the most CPU resources. This profiler is tuned for Windows applications.

For Windows developers, Microsoft uses Dr. Watson (which is part of Windows 3.1) as a UAE monitor. This program runs constantly in the background. It traps hardware exceptions generated by some types of programming errors and creates a log file that you can use to help debug the application.

For Windows developers, Microsoft offers a hot spot editor, the standard Windows SDK hot spot editor.

Microsoft’s C/C++ 7.0 offers precompiled headers. Less flexible than Borland’s implementation, they are still helpful to speed up the creation of large, multisource file projects.

Besides the various programs, an extensive online help system is provided. Online help is important because the documentation for many compilers (including Microsoft’s) often exceeds 10,000 pages.

687