SOFTWARE REVIEW: LATTICE C COMPILER VERSION 3.04.01
by Guus Surtel
Intro
After using the old Lattice C compiler for over a year, I was
very glad to recieve a letter from Metacomco introducing a major
upgrade of Lattice C. I filled in the upgrade card and send it
to Metacomco. After waiting for four weeks it finally arrived.
The package consists of three single sided disk and a 650 page
manual.
The Compiler
The compiler include the latest ANSI C propositions and the
latest UNIX V additions. The major improvement is type-checking
for functions. If you call a function, either made by your own or
from the standard library, the compiler checks if you supply the
right number of parameters and the right types. If you don't the
compiler gives you a warning. You can easily ignore the warnings,
only errors stop the compiler. You can also use a compiler
option, which disable the type-checking. I know a lot of people
who program Modula 2 or Pascal only because C has no type-
checking and Modula 2 and Pascal do. The big difference is that
with C you can ignore the generated warnings and with Modula 2
and Pascal the compiler stops generating code when it find a
error in the parameters. Also most of the people programming C on
a UNIX system say it's impossible to programming C without using
the LINT utility. The LINT utility on UNIX does the type-checking
for C sources.
An other addition conform to the ANSI C standard, is that you can
use structures and unions as a parameter for a function. You can
also return a structure or union from a function. In the old
versions of Lattice C, you had to pass the pointer of the
structure to the function and let your function made a copy of
the structure into a local variable.
The library
The most used library routines have been rewritten in assembler.
The floating-point library is also rewritten in assembler. The
floating-point routines are at least four times faster than the
old ones. This makes them faster than the floating-point
routines of Megamax C, Alycon C (DRI) and Mark Williams C. The
integer and pointer arithmatic is also speeded up.
The library is extended too. It includes new functions for
compatiblity with UNIX and XENIX environments such as abort,
access, asctime, assert, chdir, chmod, ctime, fdopen, getcwd,
gmtime, localtime, memccpy, memchr, memcmp, memcpy, memset,
mkdir, perror, qsort, fork, rmdir and tzset. The printf routine
has been greatly enchanced. For example: printf("%e*.*",a,b,c)
prints the floating-point variable a into b postions with c
decimal digits. You can also print pointer and adjus the
justification.
A number of new functions especially for the Atari ST are
included. The GEM library includes all known GEM functions. Also
included is a LINE-A library for fast graphics. Most of the
GEMDOS functions have been made functions instead of macros. This
had to be done in order to use the type-checking facility.
The total size of the libraries (C library, GEM library and
floating-point library) is 132K. You couldn't produce (without
some nifty tricks) accessoires with the old version of Lattice C.
With the new version you can.
As with previous version of Lattice C the libraries are supplied
in two forms: the GST-linker compatible .BIN and the DRI-linker
compatible .O object modules. The compiler can generate code in
both formats. The compiler can also produce relative (like
Megamax C) or absolute code. Relative code is more compact and
faster but the size of the code is limited to 64K (instead of 32K
with Megamax C).
The Editor
Apart from all this, a number of utility programs are included.
The new editor works, in contrast to the old editor, under GEM.
You can edit up to six files at once. The editor is faster than
most GEM editors I have seen. The editor has all the features you
wish programmable function keys, auto-indent, block copies
between files, repeating commands, macros etc. Most of the
commands can be reached from the GEM menubar, all commands can be
executed from the keyboard. You can create a file called ED.INF
containing your function key definitions, tab settings etc.
The Shell
MENU+, the GEM shell for Lattice C, has undergone a number of
improvements too. You now can execute different commands when a
program failed or not. I like MENU+ shell more than the
traditional MS-DOS or batch style shell. You can change and
extend the menu options yourself. You can also use it for other
compilers and programs.
UNIX Make utility
The Make utility is used for creating a program. It contains all
the relations between the different files that lead to the
program and it has been told how to create a file from another
file. For example: A program called EXAMPLE is made up of three C
files called EXAMPLE.C, MAIN.C, SCREEN.C. The relations are:
-------------
| Program |
-------------
/ | \
/ | \
------------- ---------- ------------
|EXAMPLE.BIN| |MAIN.BIN| |SCREEN.BIN|
------------- ---------- ------------
| | |
------------- ---------- ------------
| EXAMPLE.C | | MAIN.C | | SCREEN.C |
------------- ---------- ------------
If you make a change to example.c you have to recompile example.c
into example.bin and link this file with main.bin and screen.bin
to get the new program. Instead of doing this all by yourselft
you can call the Make utility. It will look at all the files and
make the program. You don't have to know wich files you have
changed and what you must do. The make utility is very useful
when your are developing a real application with a lot of source
files.
The resource editor
The new version of Lattice C now contains the Kuma Resource
editor. The Kuma resource editor is known to be the best resource
editor avalaible for the Atari ST. You can create menubars with
Icons in it and edit up to eight resources at onces. It is very
user friendly and very effective. It can read and modify
resources made with the Digital Research (only if you didn't use
any panels in your resource) and Megamax Resource editor.
The debugger
The debugger DEBUG+ is a symbolic debugger like SID. It has a lot
features. You can create macro's and define the control keys and
save them into a file called DEBUG.MAC. It includes all the
commands you expect from a debugger: flip screen, examine
registers, set breakpoints, trace, disassemble data, display and
modify data. It also has a number of commands, not seen on any
debugger for the Atari ST, variables, evaluating expresions such
as !a*10/D0 (!a stands for the value pointed to by the pointer a)
and linking ! When you are developing a program you can link it
with DEBUG+. All linking is done in memory so it is very fast
comparing to linking from a ramdisk. After linking you can easily
resolve unsolved references. The disadvantage of linking this
way is that you can't save the object program and that the
process consumes a lot of memory (All libraries needed are loaded
into memory. The libraries together consume more than 132K of
your memory). The debugger is the best symbolic debugger for the
Atari ST (the only other symbolic debugger I know is SID), but I
would like to see an even better symbolic debugger like Code View
from Microsoft (MS-DOS computers), where you see your C listing
in one window and the results in another window.
Miscellaneous
Also included are a number of little utilities (print, type, ren,
del, copy, setdate and touch), a few example programs and the
source listing from a few routines (_MAIN, STARTUP, STARTACC,
OSERR and SYSERR).
The Manual
The new improved 650 page manual, in contrast to the old 250 page
manual, contains a lot of examples programs and fragments of
programs, illustrating the numerous library functions. The manual
starts with the installation of Lattice C and how to operate the
compiler and linker, followed by the Lattice C language
definition and the programming environment. The second part
describes each of the programs on the disk. The third and fourth
part, which count for nearly 400 pages, describe all the library
functions. After that come the appendices, including A Short
Tutorial, Bibliography, Disk Contents, Error Messages, Recent
Changes, Example Programs and Customer Support. The manual ends
with a very good 18 page index. The manual is for reference only.
You will need to buy another book, if you want to learn C. A
number of recommended books are in appendix B. If you want to
make a GEM application, you will also need a book about GEM, like
hte Programmer's Guide to GEM from SYBEX.
Conclusions
I always liked the old Lattice C compiler (and developed a
commercial program with it), but the new version is simply the
best C compiler available for the Atari ST. It's out of this
world in comparision with Alycon C (Atari Development Kit), far
better than Megamax C (which is rubbish) and a lot better than
Mark Williams C. Lattice C biggest overall features are
ANSI C Standard compatible, bugless, high grade of portability
with other Lattice C compilers (MS-DOS, Amiga) and UNIX V C
compilers, huge library and last but not least: it's price of
only 99.95 (A lot cheaper than it's competitors). Lattice C has
grown from a C compiler into a delopment Kit. The only thing you
will need to buy to complete it, is an assembler like the
Metacomco Assembler, a book about C and a book about GEM.
Disclaimer
The text of the articles is identical to the originals like they appeared
in old ST NEWS issues. Please take into consideration that the author(s)
was (were) a lot younger and less responsible back then. So bad jokes,
bad English, youthful arrogance, insults, bravura, over-crediting and
tastelessness should be taken with at least a grain of salt. Any contact
and/or payment information, as well as deadlines/release dates of any
kind should be regarded as outdated. Due to the fact that these pages are
not actually contained in an Atari executable here, references to scroll
texts, featured demo screens and hidden articles may also be irrelevant.