Dwayne Phillips works as a computer and electronics engineer with the United States Department of Defense. He has a Ph.D. in electrical and computer engineering at Louisiana State University. His interests include computer vision, artificial intelligence, software engineering, and programming languages.
Power C is an ANSI C compiler from MIX Software and it costs $19.95.
My interest in Power C grew when several co-workers said they bought it and liked it. They were not professional C programmers, but I needed a small C compiler to use on my small, low-end laptop computer. What could I lose since MIX offers a 60 day money back guarantee?
What Is Included
I am reporting on the MIX Power C compiler v2.1.2 basic package. It includes:
The extra tools include mix that converts Microsoft object code files to MIX format object code files. This allows you to use object code files generated by the Microsoft assembler. Another extra tool is merge that makes libraries from your MIX object code files. The final tool is fasthdr that bundles several of your .h files into a single "pre-tokenized" .hhh file. This saves disk space and speeds compiling and linking.
- ANSI C compiler and linker
- Small, medium, and large memory models
- Huge arrays
- ANSI C standard libraries
- MIX's Power C libraries (DOS dependent and graphics routines)
- Instruction manual (650+ pages)
- Several extra tools
What Is Not Included
Power C does not include:
Most programmers already have a favorite editor, so that's no great loss. If you don't, use the DOS 5.0 editor or buy MIX's $20 one. I do recommend having a debugger even for beginning C programmer's so you should buy MIX's for $20.
- An editor
- An integrated environment
- A debugger (available for an additional $19.95)
- In-line assembly code
Power C includes a type of make utility. Power C calls this facility project files, and although it does work, it is not the best make in the world. Power C also has DOS graphics calls in its library, but, again, they are not world class. MIX sells the source code for their libraries ($10) and you might be able to extend these to fit your needs.
Does This Really Work?
Yes, it really does work. I used Power C to compile and link my Huffman coding program (CUJ February 1992) and my C Image Processing System programs (CUJ March, May, June, August, November 1991, and January 1992). While not the ultimate test of a compiler, these are fairly large and extensive. Of special note is the program that prints images to a Hewlett-Packard DeskJet (CUJ June 1991). That is a complicated set of code and Power C handled it without requiring any changes. I had to make several changes to the graphics portions of the image processing programs. The DOS C compiler companies have never established any standard graphics calls. Microsoft uses _setvideomode, Power C uses setvmode, and so on, so I expected to make these changes.
Using Power C
The installation is as simple as typing A:install and answering one question. Compiling, linking, and making are also simple. Listing 1 shows a hello world program stored in file hello.c. You compile by typing pc hello and link by typing pc l hello. You can combine compiling and linking by typing pc /e hello. There are many options for compiling and linking that specify the memory model, floating point options, and so on.You can use project files to implement a make utility. Listing 2 and Listing 3 shows another hello.c and hello2.c. Listing 4 shows the project file named hello.prj that will make the second hello.exe program. To make the second program type pc hello. The pc command will look for a .prj file and use it if it exists.
Comparisons and Applications
I performed several informal comparisons between Power C and Microsoft C v6.0 using the programs I mentioned earlier. Microsoft compiled and linked four times slower than Power C, but the Microsoft executables ran faster. One peculiar item was the Power C object files were twice as large as the Microsoft ones, but the Power C executables were smaller. The Power C executables do not reflect the size of arrays declared. For example, when I declared a short image[100][100] array in Power C, the executable was less than 20,000 bytes while in Microsoft C it was larger than 20,000. Power C allocates all arrays after the program starts executing using a dynamic method.I am not ready to throw away my Microsoft C just yet. Power C does not yet support Windows or C++ and I do not know of anyone using Power C with 32-bit DOS extenders. The graphics capabilities are weaker than Microsoft and I often use those in image processing programs. For these reasons, I do not recommend Power C for professional C programmers.
Power C is a superb product for applications such as education and fitting a compiler into small places. MIX Software packages the Waite Group's Master C book and disk with Power C as an option for C students. The price is right for those wanting to try to learn C without risking hundreds of dollars. It is appropriate if you need twenty copies of a compiler for a training program at work. It also suits starving college students in need of a C compiler for their PC.
Power C is small. The compilers, linkers, and libraries require less than 1MB of disk space. You can put them in a RAM disk or on a 1.44MB floppy disk for a low-cost laptop computer. The RAM disk usage is pleasurable. If you have 4-8MB of RAM, you can devote 1MB to Power C and still have enough for hungry applications. A C compiler in RAM is quick and comes in very handy when going through cycles of compile, test, change, compile, etc.
Conclusions
Power C is a good product and an excellent value. It is not a direct replacement for the complete Microsoft or Borland class products on the market. It doesn't do Windows or C++. Nevertheless, it implements the full ANSI C standard, gives you the memory models needed for DOS programming, and provides acceptable performance. Its price lends itself to training and educational situations and its size is good for low performance machines.
Reference
Kernighan, Brian W. and Dennis M. Ritchie. 1978. The C Programming Language. New York: Prentice-Hall.Product Information
Product: Power C Compiler
Price: $19.95
MIX Software
1132 Commerce Dr
Richardson, TX 75081
1(800) 333-0330Requirements
MS-DOS 2.0 or later
256K RAM
2 floppy drives
(hard drive recommended)