Journal Articles
Browse in : |
All
> Journals
> CVu
> 013
(15)
|
Note: when you create a new publication type, the articles module will automatically use the templates user-display-[publicationtype].xt and user-summary-[publicationtype].xt. If those templates do not exist when you try to preview or display a new article, you'll get this warning :-) Please place your own templates in themes/yourtheme/modules/articles . The templates will get the extension .xt there.
Title: Review of Mix Power C
Author: Martin Moene
Date: 28 June 2010 08:56:00 +01:00 or Mon, 28 June 2010 08:56:00 +01:00
Summary:
Body:
The first issue of C Vu carried the special offer of the MIX C compiler. This review concerns the new compiler from MIX, POWER C.
POWER C has much in common with the older MIX C. The most striking similarity is the price. The POWER C compiler costs just £24.95 (including postage & VAT). This puts it in the same 'budget' category as MIX C and Zortec (nee Zorland) C.
For the #24.95 what you get is a 670 page paper back manual cum tutorial book (a book of this size on C can easily cost #25 on its own) and two 360k 5 1/4" or 1 720k 3 1/2" disks containing the Power C compiler PC.EXE, the Power Linker PCL.EXE. The disks also contain a selection of standard header files and the C libraries in object form.
Power C uses the '.MIX' object format as used by MIX C instead of the Microsoft standard '.OBJ' format. This is no problem as the PCL linker will produce standard .EXE files at the end of it. MIX also provides an assembler that will assemble into the .MIX object format - more of that later.
So far I have concentrated on similarities between MIX C and Power C. Now some of the differences:
Firstly Power C banishes the main deficiency of MIX C - the slow speed of the code compiled with it. The original MIX C was a fast compiler but the code produced was not very efficient and therefore ran much slower than code produced by more painstaking but therefore slower systems like Zortec C.The new Power C compiler is still fast but can now produce respectably fast object code as well.
I compiled the dhrystone benchmark program (a well established test of the capabilities of a compiler or a machine to execute a 'typical' application program) under Power C and it gave a very similar dhrystones per second rating as a Microsoft C 4 compiled version of the same program. All Power C programs are optimised. The Optimiser is part of the compiler and not a separate (extra cost) program like Zortec's.
Secondly Power C is far more compatible with other C compiler than MIX C was. The compiler conforms to ANSI standards and the libraries provide many of the functions that Microsoft and Turbo C compilers offer plus numerous useful extensions for graphics, TSR writing and maths.
I tried compiling several things from the CUG source code library and experienced very few problems. The Power C compiler is strict about re-defined macros and treats one as an error. This stopped a few things compiling first time but is easily fixed by an #ifdef of #undef in the code. It will also take programs originally written for MIX C and vastly improve their execution speed. A word of warning is needed here though, as the POWER C libraries are now ANSI standard and Microsoft compatible some of the functions are different form what they used to do in MIX C. I got caught out with the settime() function which sets the MS-DOS time of day. In MIX C this function just took a string with the time in it but Power C does things the 'correct' way and uses an argument of type (struct time *).
When converting programs up from MIX C it is a good idea to cross check all the library functions used in both manuals to see if they still do the same thing.
Power C comes with sample programs to demonstrate the graphics library. The best of these is a simple program that asks for values and displays a pie chart on the screen. The graphics libraries allow programs to be written that will work on CGA, Hercules, EGA and even the new VGA screens. The Piechart program will use colours for colour screens and resort to cross-hatch patterns when the screen is mono.
The graphics support may not turn you into a video games designer overnight but it is more than adequate for business graphics of all kinds.
Another fun feature of the Compiler is the ability to write 'Terminate and stay resident' programs using functions from the library without having to resort to assembler. The manual contains an example for an on screen clock. The program compiles down to about 3k so TSRs are quite possible in C. Playing with TSRs is something that has always interested me but in the past I have been put of by having to write it all in assembler. The Power C Library does all the assembler bits like intercepting interrupts leaving the real work of a TSR in easily understandable C.
An important extra available with Power C is the source code for the libraries. This costs an amazing #10. The library source code for other compilers is usually only available for a very high price, if at all. The Power C source is complete and offers valuable extra documentation and the ability to change anything that doesn't suit you. The library sources even come with a simple assembler PCA.EXE which is used to assemble the low level assembler parts of the library. I really like the provision of an assembler. PCA is ideally suited to the short sections of assembly code needed to support a high level language. It is small and simple without any of the complex structuring required by MASM. I think that it is the only assembler that a C programmer is likely to need and is a great improvement on MIX's original policy of making you use Microsoft MASM with special macros and then converting .OBJ to .MIX with the MIX utility.
I have successfully run the Power C compiler an Apricot PC as well as IBM compatible machines so, armed with the library sources, POWER C is suitable for
Apricots and any other non-clones as most of the library function of IBM machines could be reproduced and even improved upon. The Apricot PC for example has 800x400 video and a sophisticated (by PC standards) sound chip so those areas of the Power C library could be re-written to use the features of the Apricot BIOS to good effect. The only problem with Power C for non IBM clones is that the Power C Trace debugger would not be usable.
For those of you interested in financial applications a BCD Business math library is available for a further #10. This allows calculations to take place without the rounding errors associated with the normal floating point system.
I see POWER C as an ideal compiler for the serious home user and part time software developer. The library is good enough to write serious fast executing software (with NO royalty on compiled programs). It is not in absolute terms as fast or comprehensive as a top range commercial development compiler like Microsoft C 5 but at #25 plus #10 for the library sources and assembler it offers very good value for money indeed when compared with the #400 plus needed to buy a full Microsoft C 5 system.
POWER C is available from:
ANALYTICAL ENGINES Ltd.
P.O. BOX 35, EASTLEIGH, HAMPSHIRE SO5 5WU
In the next issue I shall be reviewing POWER CTrace, the debugger that goes with Power C to enable the quick and painless debugging of Power C programs.
Notes:
More fields may be available via dynamicdata ..