From: neeri@iis.ethz.ch (Matthias Neeracher)
Subject: Re: Sozobon (or other free C's): would this strategy work?
Organization: Integrated Systems Laboratory, ETH, Zurich
Distribution: comp
Date: Tue, 5 Jan 1993 18:38:49 GMT

[comp.sys.atari.st.tech dropped from newsgroups]
In article <1993Jan5.023237.18823@cs.yale.edu>, bobf@flint.geology.yale.edu (Bob Fischer) writes:
> 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".

I agree.

> 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.

Not necessarily. The executable for gcc is already almost 2M on a '386 and even
bigger on other architectures. The gcc 1.37 port for MPW needed about 3.5M, if
I recall correctly. Anyway, I think it can be made to run in 4M and that might
be satisfactory.

> My reasons for this assessment 
> follow:

> * 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.

True, but there remain enough *real* incompatibilities between a Mac and UNIX
that this won't ever become an issue.

> * 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. [...]  The FSF [...] is dedicated to
> bringing a full UNIX-compatible system to everyone [...]

Everyone but Macintosh users, that is. The FSF's conditions for lifting their
ban on Macintoshes won't be accepted by Apple, and even if the boycott is
lifted, don't expect the FSF to ever actually do active support for the Mac.

This is not as much an issue as it might seem, since gcc for UNIX is here to
stay and you can always progress from there and the FSF clearly doesn't claim
that porting their software to the Mac is illegal.

> [...] 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.)

Almost all reasonably sized GNU tools have been ported to both MPW and Think C,
(including an avalanche of Ghostscript ports lately :-), so providing gcc
probably won't provide that much of a benefit. Additionally, porting problems
tend to be in the library and the user interface rather than the C dialect.

> * 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. [...] 
>  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.

All of this is true, but don't underestimate the difficulties anyway. There is
a quite instructive paper on porting gcc 1.37 to MPW on
ftp.ugcs.caltech.edu:pub/topsoft/misc/gccport.cpt.hqx (Unfortunately, I can't
remember the author right now, it might have been Stan Shebs). 

> * 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.

Absolutely correct (I believe there is even Objective C available today).

> I hope that GCC will see the light of day on the Mac.

So do I (but I don't think I will do anything about it :-).

> Since the Mac
> is not really a hacker's computer, few people have shown an interest
> in porting it.

I don't think that's the reason. Lots of other hacker's tools have been ported,
but gcc and emacs are just rather big programs and the Mac is not particularly
UNIX compatible (gcc and emacs *are* available under A/UX, which sort of proves
my point). Another reason against porting gcc is that there are already at
least two powerful, well-integrated compilers around. I doubt that you could
get gcc to compile even as fast as MPW C, let alone Think C, especially if you
consider that gcc needs a separate assembly step. If you add the necessity of
writing a decent user interface for a standalone compiler, I doubt that people
will be willing to spend a lot of effort in writing the 3rd fastest and 3rdmost
compatible C compiler for the Mac (If anybody *is* willing, though, I applaud
his dedicationand he might get famous).

> But I think a lot of people would benefit from a port,
> given the large numbers of Mac users.

My parents use Macs, too, but I doubt they would benefit from a port.
Seriously, though, I think the target audience is not that big. gcc is too big
for amateur programmers, too slow for many non-amateurs, and some programmers
wouldn't like to use a standalone compiler (I want my MPW :-).

Matthias

-----
Matthias Neeracher                                      neeri@iis.ethz.ch
  "I wouldn't recommend sex, drugs or insanity for everyone, but
   they've always worked for me." -- Hunter S. Thompson
Newsgroups: comp.sys.mac.programmer,comp.sys.mac.system