[comp.sys.ibm.pc] RFC: MS C v. Lattice C

mintz@hpindda.HP.COM (Ken Mintz) (04/28/88)

Can someone offer some constructive views on MS C v. Lattice C:  is one
better than the other; if so, why?  BTW, I don't intend to develop code
for windows, nor do I indend to use windows myself.

Pointers to recent reviews in magazines would be welcomed.

Thanks in advance.

Ken Mintz

hollen@spot.megatek.uucp (Dion Hollenbeck) (04/29/88)

From article <4330063@hpindda.HP.COM>, by mintz@hpindda.HP.COM (Ken Mintz):
> Can someone offer some constructive views on MS C v. Lattice C:  is one
> better than the other; if so, why?  BTW, I don't intend to develop code
> for windows, nor do I indend to use windows myself.
> 

I am using Lattice C at work for some very sophisticated embedded system
development.  My company purchased it because it was the only compiler
warranteed by the manufacturer of SoftProbe 86 simulator (runs on a
SUN or VAX or PC - cannot say enough good things about Soft Probe and
SSI who makes it).  Lattice C is something else.  Calling it a toy is
not quite accurate, but closer than calling it a real-world compiler.
It has no switches to control optimization, no support for in-line
assembly and I have discovered numerous bugs (several of which were
fixed in the 3.24 release).  The worst bug (still not fixed and Lattice
is hemming and hawwing about even looking at it) occurs when asking
the compiler to include symbolic debug information including line
numbers, symbol names and symbol types.  In 75% of the source files
(I have about 20) it will generate object modules which are rejected
by the linker.  Unfortunately, the lack of symbol types cripples
emulators and simulators from being powerful and reduces me to 
calculating offsets into complex nested structures by hand instead
of being able to refer to 'foo->bar.zips.alt.boo'.

Lattice does support all the memory models and has adequate documentation.
Their standard libraries seem to be well written, but there are not
a lot of nifty extensions.

Also, I have the Microsoft 4.0 C compiler and it has lots of
features such as selective optimization, complete symbols and types,
etc.  Microsoft is notoriously bad about support as you may have 
gathered from postings in this group.  Their documentation is not
a whole lot better than Lattice.  Their attitude towards fixing bugs
is not that great.

We did not select MS C because at the time of purchase, it had only
been ported to SUN UNIX for only a couple of months and there were
next to no embedded system development tools.  Also, SSI would not
warranty it to work with SoftProbe (a feature which was critical
to the project, since the hardware would not be available to test
on and we could debug on the simulator without going to the hardware
until the last minute).

In summary, both compiler are adequate.  In my opinion, MS C is the
better choice of the two.  MS C generates vastly superior code
optimization and seems to be more full featured.  However, it you
are not doing heavy duty development the best bang for the buck is
the MIX POWER C which also has the most superior documentation for
a beginner.  As much as I like the CODEVIEW debugger system, MIX
beats it all to heck (BTW, Lattice has NO debugger).



	Dion Hollenbeck             (619) 455-5590 x2814
	Megatek Corporation, 9645 Scranton Road, San Diego, CA  92121

                                seismo!s3sun!megatek!hollen
                                ames!scubed/

mintz@hpindda.HP.COM (Ken Mintz) (04/29/88)

> Lattice does support all the memory models....

  Does MSC support all memory models?  What about TurboC?

Ken Mintz

mintz@hpindda.HP.COM (Ken Mintz) (04/30/88)

[I'm posting this without the author's permission, so I've left off the
signature.  Altho I've appreciated all responses, this is one the most
comprehensive so far. -- Ken Mintz.]

Is there any particular reason you are even THINKING of CONSIDERING Lattice?

[Because I used LC many years ago.  My choice of MSC and LC in the basenote
was not intended to demonstrate any bias or predisposition, but only my level
of awareness at the time.  I omitted TurboC as an oversight. -- Ken.]

Three or four years ago, it may have been an industry standard, but since
then, it has been left completely in the cold by MS, Turbo, Datalight, and
others.

Before version 3.0, MSC was Lattice, repackaged in a Microsoft wrapper.
Starting with version 3.0, Microsoft developed their own C compiler.  Starting
with version 4.0, Microsoft C took over the "industry standard" title, although
they are on version 5.1 now with no real improvement since 4.0 (if anything, it
is buggier than ever).

So much for broad generalities.  Down to specifics:

Microsoft supports close to full ANSI specs, Lattice doesn't come close.
Some of these features you may never use, but some, like function prototyping,
can be indispenisble in large projects.  Lattice no longer chokes on function
prototype definitions, but it doesn't use them in a useful way (void pointers
are not implemented properly, so you get thousands of spurious pointer
mismatch warnings when calling library routines, for example).
Microsoft's code quality is significantly (double digit percent wise) better
than that produced by Lattice.

Lattice has, arguably, the slowest compiler available.  Microsoft's full
optimizing compiler in the same ballpark, but they include Quick C with the
package, which compiles at over twice the speed of Lattice.

Microsoft's library is much more complete than Lattice.  Lattice's library is
big, but many of the functions are so specialized (esp. some of the string
functions) as to be useless.  Microsoft starts with the ANSI library, adds
some of the more useful Lattice functions, and has a nice set of DOS and BIOS
interface functions which Lattice completely lacks (Lattice has only functions
that require you to explicitly set all the register values in a structure,
and tell the interrupt number - which makes the function call overhead quite
large, and requires you to have a tech ref or Peter Norton book on hand to
tell you which interrupt, function number, and registers you want).
Microsoft's library also has graphics functions (but they don't do Hercules,
alas), which Lattice doesn't have.

Microsoft comes with a source level debugger.  Lattice sells a pretty useless
one separately.  MS's codeview works only with MSC, and it does things no
other debugger can (such as refer to local variables by name).
If you are into integrated environments, MS's Quick C has built-in editor,
debugging facilities, etc.

MSC supports mixed language programming - so you can call MS Pascal routines
from C and vice versa

MSC has full support for mixed memory model programming as well.

Turbo C (Borland) has most of the features of MSC, with the following
differences:
- they sell only the fast version of the compiler, which compiles as fast as
  MS's Quick C, and produces code close to MS's "slow C" (the full optimizing
  compiler which is several times slower)
- it supports in-line assembly if you have MASM; even if you don't, you can
  assign to and use values of registers directly (pseudo-variables _AX, etc)
- the graphics library is standardized with Turbo Pascal 4.0 and other Borland
  products, and supports Hercules, and can be user extended to support any
  adapter, and user designable character sets
- it is not NEARLY as buggy as MSC; the known bugs all have published fixes
  on Compuserve (and you get free subscription $15 time when you buy Turbo C)
- no debugger, although you can use third party debuggers, including a PD one
  from Compuserve that was uploaded to the net recently

Datalight is another of my favorites.  It is almost as fast as Quick or Turbo,
produces better code than either, and, when you turn on full optimization
(which slows it to MS "slow C" speed) it blows everyone out of the water.
Library is kind of weak, but is full ANSI with lots of DOS and BIOS extensions
and INCLUDES FULL SOURCE FOR ENTIRE LIBRARY!  Previously it was Lattice
compatible (you can link DLC and LC object modules), but has recently (the
forthcoming version 4.0) jumped ship to the Microsoft convention (Turbo is
also MS compatible).  Datalight upgrades the compiler every three months or
so; for $60 a year you can download latest versions from their BBS, or pay
$20 a shot (about half of everyone else's upgrade cost, BTW), or, if you sent
in a bug report, you can get an upgrade free.  Documentation is kind of weak,
(there is no C tutorial or anything like that), but it does come in a three
ring binder, and is more than sufficient if you have an average amount of
common sense.  Datalight C supports most of the ANSI and MS extensions, with
the exception of mixed language support (and the mixed memory model support
is more limited).

Full MSC is over $200, Quick C by itself (doesn't include Codeview debugger,
but has some integrated debugging) is about $60, so is Turbo.  Datalight is
about $90.  Library source for MSC and Turbo is available for $150.
Lattice is >$200, and source for library is available, but I forget how
much it costs (although $150 or so is a good guess).

>Pointers to recent reviews in magazines would be welcomed.

Seems almost everyone did a C compiler review about a month or two ago.
Something called "Micro Cornucopia" or something like that, PC TECH Journal,
maybe others.  Older reviews (such as one in Dr. Dobb's Journal just of 
MSC, Turbo C, and Datalight C half a year ago) are worthless by now, as all
companies seemed to have released new versions this year.