From: bobf@flint.geology.yale.edu (Bob Fischer)
Subject: Re: Sozobon (or other free C's): would this strategy work?
Organization: Yale University, Department of Computer Science, New Haven, CT
X-Newsreader: TIN [version 1.1 PL6]
Distribution: comp
Date: Tue, 5 Jan 1993 02:32:37 GMT

J R Evans (ngse18@castle.ed.ac.uk) wrote:
: 
: I week or so back, I offered the suggestion that it might be a
: reasonably modest task to convert Sozobon C (a fairly small K&R C for
: the Atari) to work on the Mac.  There has been some follow-up
: discussion....
: Sink (author of Harvest C) and Brad Pickering.  Eric and I have had an
: interesting discussion by email, and I have received helpful comment
: from a number of others.  My thanks to all who have corresponded, and
: particularly to Eric.
: 
: I have given the possibility quite a bit of thought, read some relevant
: documentation, and come up with a strategy which I would like to
: share with you, by which this might be achieved reasonably rapidly.
: I invite your comments.  Although I discuss the strategy in terms of
: Sozobon C as the target for transport, it could also be used with any

The outlined strategy may work, but I'm not so sure it's a good idea.
If I were going to port a C to the Mac, I'd do GNU C, and port it "the
right way".  Sure it's huge, but as you said, memory on the Mac isn't
such a big deal anymore.  The smallest Mac you can buy nowadays is 2
Mbytes, more than adequate for GCC.  My reasons for this assessment
follow:

* GCC is a full (even extended) ANSI C language, and was carefully
written to conform to the ANSI standard.  Since ANSI C is the
standard, programs, especially ones written in the future, are liable
to not compile on K&R compilers.  I write all my code in ANSI C,
because it's a big improvement over K&R and it makes my life easier.

* GCC is a very good compiler.  GCC version 2 optimizes as well as the
best commercial optimizing compilers (much better than the compiler
distributed with SPARCstations only 2 years ago, and much better than
any other Atari compiler).

* GCC runs on many systems, including a zillion flavors of UNIX,
MS-DOS, and the Atari ST.  Therefore, a program written in GCC is more
likely to work on other systems than a program developed with _any_
other C compiler (like, say, SUN's compiler, or Mark Williams C).  A program
written with one GCC need only be compiled by another GCC to provide an
easy port.  Potential problems of hidden compiler incompatibilities
between systems are eliminated.

* GCC is backed by the Free Software Foundation.  This is not a
program which will lose support when one or two people taking care of
it decide to do something else.  (I know.  I wrote The Vault, and now
that I don't feel like supporting it anymore, no one is supporting
it.)  The FSF, headed by Richard Stallman, under the guise of the GNU
project, is dedicated to bringing a full UNIX-compatible system to
everyone, and GCC is part of that.  (Incidentally, while the FSF tries
to write programs which compile with other people's C compilers, the
GNU project compiles most reliably with GCC.  This includes re-makes
of programs like make, yacc, lex, sh, to name a few.  GNU project
programs not part of standard UNIX include a full PostScript
interpreter.)

* Finally, the most compelling reason is that I think that GCC would
be the easiest to port!  GCC was written in a modular way, so that it
can be ported to any system, running any instruction set.  What
porting it consists of is describing, in GCC's machine-description
language, the properties of your computer's instruction set.  The code
generators and optimizers use this information to generate code for
your computer.  Adding a new machine description to GCC does does not
eliminate the possibilities for GCC to generate code for other
machines.  (This means that GCC can be easily used as a cross-compiler
--- build the standard distribution to run on one system, but to
produce code for another.)  Since someone has already described the
68000 instruction set to GCC, you would just have to modify the
description, to make it work with the Mac quirks (like the special
status of A5).  To encourage people to port GCC, Richard Stallman
(author of GCC) has written a 190-page manual describing in detail how
to port GCC.  I don't believe any other program comes with such
carefully written porting instructions.

* And last but not least, GCC is not just a C compiler.  It consists of
a front end, to parse programs, and a back end, to generate code.  GCC
version 2 includes C++.  The FSF is working on implementations of
FORTRAN and other languages, all which use the GCC back end.  So the
effort into porting GCC results in two languages ported today and
potentially many in the future.

I hope that GCC will see the light of day on the Mac.  Since the Mac
is not really a hacker's computer, few people have shown an interest
in porting it.  But I think a lot of people would benefit from a port,
given the large numbers of Mac users.

--- Bob Fische
Newsgroups: comp.sys.mac.programmer