[HN Gopher] A History of C Compilers - Part 1: Performance, Port...
       ___________________________________________________________________
        
       A History of C Compilers - Part 1: Performance, Portability and
       Freedom
        
       Author : gulced
       Score  : 127 points
       Date   : 2024-05-05 12:28 UTC (10 hours ago)
        
 (HTM) web link (thechipletter.substack.com)
 (TXT) w3m dump (thechipletter.substack.com)
        
       | PikelEmi wrote:
       | The mentioned Byte Magazine:
       | 
       | https://archive.org/details/byte-magazine-1983-08/page/n13/m...
        
       | stevekemp wrote:
       | I've recently been working on a CP/M emulator, and having a lot
       | of fun working with the Aztec C compiler referenced in the list.
       | 
       | It's strange to go back to old-school function definitions:
       | main(argc, argv)           int argc;           char *argv[];
       | {
       | 
       | But a C compiler in only 40k, assembler in 20K, and linker in
       | another 20K is a whole world of tiny software compared to what we
       | use right now.
        
         | pjmlp wrote:
         | Around 2000 the HP-UX 10 aC compiler that we had available,
         | still wasn't fully ANSI/ISO C89 compliant for function
         | declarations, talk about taking its time.
        
         | nineteen999 wrote:
         | The Hi-Tech C compiler for CP/M works quite well also, and
         | generates pretty compact code.
         | 
         | sdcc can be used to cross-compile for CP/M from a modern PC, if
         | you provide a crt0.rel and libc. I rolled my own and was able
         | to port a few useful programs and utilities with it.
        
           | anthk wrote:
           | You might like this:
           | 
           | https://t3x.org/t3x/0/index.html
           | 
           | Pascal like language, compiles at Unix and to DOS and CP/M,
           | it can be run under CP/M too. It can compile both binaries
           | and bytecode.
           | 
           | I ran a faithful Ladder port natively under a GNU Unix 386,
           | it's really good:
           | 
           | https://t3x.org/t3x/0/programs.html
        
             | nineteen999 wrote:
             | I took a look at T3X a while back, it looked really
             | interesting. Thanks for reminding me.
             | 
             | My greatest claim to fame was embedding a Z80 emulator in
             | Unreal Engine, extending it with TCP/IP and VT100
             | emulation, and being able to connect to BBS's on the
             | internet, and run Rogue, Zork and Wordstar along with most
             | other Z80 CP/M software:
             | 
             | https://i.imgur.com/aSc9VGL.png
             | 
             | https://i.imgur.com/dd0Nzo2.png
             | 
             | https://i.imgur.com/Usjd4Vk.png
             | 
             | https://i.imgur.com/Y5aIjCi.png
             | 
             | https://i.imgur.com/rIY1he8.png
             | 
             | (yes I know color CP437/ANSI graphics was not a thing on
             | 8080/Z80 CP/M. But it was not difficult to make it work and
             | it looks pretty in Unreal).
        
           | stevekemp wrote:
           | I haven't gotten round to trying the Hi-Tech compiler yet,
           | primarily because it won't run under my emulator. I just
           | added a couple of missing syscalls but the only output I see
           | is "Out of memory".
           | 
           | (Removing the "-v" flag causes it to generate some submit
           | files, with $$$ suffix, but I don't yet support those in my
           | CCP.)
           | 
           | I'll try it on real hardware next week and if it works there
           | I guess that'll be another fun bug to hunt down!
        
             | nineteen999 wrote:
             | I didn't bother with emulating CP/M itself, just the Z80
             | CPU+RAM and disk interface, which I made compatible with
             | Udo Munk's z80pack. I was able to use the stock z80pack
             | BIOS/BDOS so I didn't have any issue getting it to run.
             | 
             | You are going deep!
        
               | stevekemp wrote:
               | Yeah I'm doing things the hard way, for sure! But the
               | project grew little by little, and I'm enjoying the
               | process.
               | 
               | (And it has to be said one of the reasons I'm interested
               | is because I have a Z80-based single-board computer which
               | runs CP/M natively which helps for testing things.)
        
         | kragen wrote:
         | have you tried bds c? it's fully free software now, runs under
         | cp/m, and is reputed to be much nicer than aztec c, so i'm
         | curious to hear your point of view
         | 
         | fwiw i suspect implementing only ansi c function headers and
         | declarations would result in a slightly _smaller_ c compiler
         | than implementing only the k &r style ones
        
       | MaxBarraclough wrote:
       | > According to Michael Tiemann:
       | 
       | > > I wrote GNU C++ in the fall of 1987, making it the first
       | native-code C++ compiler in the world.
       | 
       | I thought Walter Bright's _Zortech C++_ compiler held that
       | honour, but apparently [0] that was released 1988.
       | 
       | [0] http://www.edm2.com/index.php/Zortech_C%2B%2B
        
         | WalterBright wrote:
         | Tiemann's compiler was in beta, ZTC++ was released as a
         | commercial product.
        
       | mannyv wrote:
       | This totally neglects to mention that the commercial c compilers
       | kicked gcc's ass when it came to performance. Sun's cc and and
       | IBM's xlc were substantially better across the board, and I know
       | the latter supported profile-based optimization.
       | 
       | There were also a bunch of commercial c compilers, all of which
       | I've forgotten.
       | 
       | gcc was the lowest common denominator compiler, with the benefits
       | and drawbacks of being in that position.
       | 
       | In any case gcc won the *nix compiler wars because it was free
       | and easily accessible. Getting a license for the commercial
       | compilers took work and/or funds, and the latter was something
       | most unix users didn't have.
        
         | johngossman wrote:
         | And they weren't cheap either. The Sun compiler was over $1000
         | IIRC.
        
           | pjmlp wrote:
           | That was the reason why GCC adoption took off in first place.
           | 
           | During the UNIX freebie days no one cared about Stalmman's
           | freedoms.
           | 
           | After Sun being the first UNIX vendor to split UNIX into
           | multiple SKUs, for developers and users, then GCC suddenly
           | became relevant after all.
           | 
           | For languages like Ada, this was even worse, because
           | SunOS/Solaris SDK only contained traditional UNIX compilers.
           | For something like Sun Ada compiler, it was extra.
        
             | anthk wrote:
             | You all forgot something: on stability and speeds, Unix
             | compilers rot over time.
             | 
             | From 1996-1999, _the_ stable choice on both speed and
             | reliability was the GNU one.
             | 
             | https://pages.cs.wisc.edu/~blbowers/fuzz-2001.pdf
             | 
             | FVWM ran circles around MWM or CDE itself about speed. Rxvt
             | was much lighter than an xterm, not everyone needed to plot
             | Tek graphs. Even some late Irix users preferred JWM against
             | the propietary options.
             | 
             | Nowadays, GNU's the slight bloated one, being Guix the
             | 'essential' GNU distro, making lots of 32 bit machines
             | without SSD's a crawling nightmare to install.
        
               | nineteen999 wrote:
               | > From 1996-1999, the stable choice on both speed and
               | reliability was the GNU one.
               | 
               | Meh, gcc 2.8 was buggy as hell on Linux/i386 by around
               | 1998, as was gcc 2.95 up to 2.95.3. The issues with it
               | are what led to the egcs fork which eventually replaced
               | the original gcc branch. So it wasn't all sunshine and
               | roses.
        
               | guenthert wrote:
               | I thought it was missing features in the C++ compiler and
               | its less-than-perfectly-clear error messages which led to
               | the split. The C compiler was pretty sound early on.
               | Sure, occasionally there were bugs, but users, including
               | Linus Torvalds, complained loudly about those, _because_
               | expectations were already high.
        
               | pjmlp wrote:
               | Can't say much on that regard, because we only used GCC
               | on Linux distributions, everywhere else it was the
               | vendors C compilers.
               | 
               | Interesting that you mention stability, exactly during
               | the GCC vs egcs politics time frame.
        
             | matheusmoreira wrote:
             | > During the UNIX freebie days no one cared about
             | Stalmman's freedoms.
             | 
             | No one cares about their freedom until they are denied it.
        
               | pjmlp wrote:
               | The rise of non-copyleft licenses proves that the only
               | freedom most people care about is their wallet's.
               | 
               | Most GPL software won't survive its authors, even Linux
               | kernel remains to be seen when Linus et al are gone, and
               | it gets taken over by newer generations VC driven.
        
               | medo-bear wrote:
               | > The rise of non-copyleft licenses proves that the only
               | freedom most people care about is their wallet's.
               | 
               | This ignores how much freedom the wallet requirement
               | takes away.
        
         | klelatti wrote:
         | > This totally neglects
         | 
         | > ... Part 1 ...
        
       | johngossman wrote:
       | This makes me feel very old. I remember that issue. I was a
       | Pascal snob at the time but interested because C had a reputation
       | for speed. A year later I got my first job and read K&R, not
       | realizing I would be using C and C++ for most of my career. It
       | mentions Lattice C. Does anybody here remember if Microsoft C was
       | a fresh start, or did they license the entire codebase and use it
       | for a start? I used Lattice on both PC and Amiga, but quickly
       | dumped it on Amiga in favor of Aztec C, for which I still have
       | fond memories. It was much faster and produced a ASM file
       | intermediary which was useful for figuring out how to optimize.
       | Nostalgia is a powerful drug. I'm sure I'd blanche with horror
       | having to develop with those tools today.
        
         | eesmith wrote:
         | The linked-to article says:
         | 
         | "One that has survived is Lattice C, one of the most performant
         | of the compilers tested by Byte. Lattice C was so good that it
         | was licensed by Microsoft and sold as Microsoft C V1.0 before
         | being replaced by Microsoft's own in-house Microsoft C V2.0
         | compiler."
        
           | johngossman wrote:
           | I read that, but I'm not convinced it is correct. It is a
           | best ambiguous--development could have gone internal but
           | started with the Lattice codebase. It is also incorrect at
           | least as to version numbers. MSC 3.0 was the first version
           | that wasn't developed by Lattice, whatever the provenance of
           | the source
        
             | eesmith wrote:
             | Peter Norton wrote this in 1983:
             | 
             | "The Microsoft C compiler has interesting historical roots.
             | Although Microsoft itself works with C, this compiler is
             | not a direct Microsoft product. Instead, it is an
             | adaptation of the famous and highly regarded Lattice C
             | compiler."
             | 
             | There are also ads like https://archive.org/details/PC-
             | Mag-1984-09-04/page/n51/mode/... saying "Microsoft C
             | compiler / Includes Lattice C and the MS Librarian".
             | 
             | I can't find info about v2 or v3.
             | 
             | Edit: https://winworldpc.com/product/microsoft-c-c/2x says
             | "Microsoft C 1.0 and 2.0 are a rebranded version of
             | Lifeboat Associates Lattice C", so your doubt seems well
             | founded.
        
               | pjmlp wrote:
               | Another historical note, if I remember correctly,
               | Microsoft was the last C compiler vendor on MS-DOS to add
               | C++ support, which happened on Microsoft C/C++ v7.0
               | release, their last release for MS-DOS as well, before
               | Visual C++ came to be.
        
         | mek6800d2 wrote:
         | Obligatory mention of Ed Post's "Real Programmers Don't Use
         | PASCAL"! You switched from Pascal to C instead of Fortran, but
         | I suppose that is semi-acceptable!
         | 
         | https://www.ecb.torontomu.ca/~elf/hack/realmen.html
        
       | blairfrandeen wrote:
       | You had me at "Free University Compiler Kit"
        
         | e63f67dd-065b wrote:
         | It was written by Tanenbaum, who worked at VU Amsterdam, which
         | translates roughly in english to the Free University of
         | Amsterdam. VU remains to this day a fairly significant
         | institution in the field of CS academia.
        
       | HarHarVeryFunny wrote:
       | gcc really was a game changer.
       | 
       | Software tools used to be really expensive. I remember in the
       | 1980's buying both Rational System's Instant-C and WATCOM-C
       | (32-bit DOS compiler) each for many hundreds of dollars before
       | switching to free Linux and gcc.
       | 
       | Instant-C was, at the time, a magical kind of product. It was
       | basically a C interpreter that could resolve undefined symbols at
       | runtime - run your program then write a function and continue if
       | it was missing. You edited code by function rather than by file,
       | so everything was incremental and instantaneous, a big contrast
       | to the normal experience back then of kicking off a big build and
       | practicing your juggling while it progressed..
        
         | cenamus wrote:
         | Was there a connection to any Lisps? Cause that sounds
         | extremely like the interactive developement process there
        
           | HarHarVeryFunny wrote:
           | I don't know if that was part of the inspiration or not - I
           | don't recall Rational themselves selling LISP. It was really
           | just a way to speed up the whole compile-link-debug cycle. It
           | was only a relatively short-lived product - I suppose since
           | the speed of Turbo-C provided much of the same benefit.
        
             | anthk wrote:
             | A LISP 'repl' environment (read-eval-print-loop) works
             | exactly like that. Stop on an error, fix it, continue like
             | nothing. Unix and C where designed to fault/abort fast on
             | errors, and showing no output on good behaviour.
        
       | bwanab wrote:
       | Late 70s, I worked for a company that built embedded monitoring
       | equipment. They'd been using the Intel 8051 coding it with
       | assembly and had just done their first Z80 boards. I was fresh
       | out of college and told them I could code it in C in 1/4 the time
       | they'd been getting assembly code done. They gave the go ahead
       | and I bought Whitesmith's cross compiler. I was able to code and
       | test on the pdp-11s, then burn ROMs to test on the target
       | machine. They were stunned when I requested another 4K of ROM,
       | but went ahead. We did several devices this way before I moved
       | on. They never went back to assembly though. Fun times.
        
       | thefaux wrote:
       | > FORTRAN was provided for the IBM 1401 by an innovative 63-pass
       | compiler
       | 
       | Must have been fantastic to debug when there was an unexpected
       | interaction between pass 37 and 51.
        
         | mjcohen wrote:
         | IIRC, it was a 53-pass compiler.
        
       | svilen_dobrev wrote:
       | About 1988-1990, There was a Metaware HighC (and C++) compiler,
       | which had platform-coverage comparable to GNU - RISCs, intel x86,
       | etc. With own "yield" extension (yeah, generators/coroutines,
       | back then), and few others. Maybe the first locally And globally
       | heavily optimizing one.. the assembly code produced was looking
       | rather weird But was faster and/or smaller than others.
       | 
       | no idea what happened to that company
        
         | pulse7 wrote:
         | https://www.synopsys.com/dw/ipdir.php?ds=sw_metaware
        
       | WalterBright wrote:
       | The article neglects to mention Datalight C, the first C compiler
       | using data flow analysis optimizations. It did such a good job
       | that the magazine reviewers decided it was cheating by deleting
       | the meat of their benchmark codes. What actually was going on was
       | the benchmark code was proven by DFA to do nothing, so was
       | removed.
       | 
       | Within a year other compilers started doing DFA.
       | 
       | The article also neglects Zortech C++, the first native code
       | generating C++ compiler. ZTC++ was the catalyst that made C++ a
       | major language, as the PC was where 90% of the programming was.
       | Before ZTC++, C++ and Objective-C were neck and neck, judging
       | from the volume on comp.lang.c++ and comp.lang.objectivec. With
       | ZTC++, the volume of the former exploded, and Objective-C
       | disappeared into oblivion (later resurrected by Apple for a
       | while).
        
         | WalterBright wrote:
         | P.S. The DFA I wrote for Datalight C still persists in the DMD
         | D compiler:
         | 
         | https://github.com/dlang/dmd/blob/master/compiler/src/dmd/ba...
        
         | kragen wrote:
         | these are indeed significant omissions, and you wrote both
         | datalight c and zortech c++
        
       | teo_zero wrote:
       | I still remember my first steps with C on my Amiga, after years
       | of BASIC. I opted for the Dice compiler because Lattice was too
       | expensive. At that time the norm was to send the money via mail
       | and receive floppy disks in exchange via the same means. By pure
       | chance, the Dice distributor in my country lived in my city and
       | we could close the deal in person, in a parking lot like
       | smugglers or pushers!
        
         | robinsonb5 wrote:
         | Dice was very nice - and later on vbcc was pretty cool, too. In
         | fact vbcc is so nice I used it for a toy CPU project a couple
         | of years ago, because its backend interface is unusually well-
         | documented and accessible. (I think tangling with either gcc or
         | llvm would likely have added another six months to the
         | project.)
        
       | massifist wrote:
       | I remember sometime back in the 90's buying a used copy of Visual
       | C++ 5.0 from some dude at the mall. It felt kinda shady, like a
       | drug deal was going down, but I turned out well and I scored a
       | legit(?) copy for much cheaper than market value. I was very
       | excited when I got it home, and it kept me busy for a long while.
       | There's a lot of good documentation (and source code) on those
       | CD's and it taught me a lot, (pretty much) coming from Quake C.
       | 
       | I think at some point I also started using DJGPP, which pushed me
       | toward GCC (and Linux).
        
       | kragen wrote:
       | i would have thought 01983 was a bit early for
       | 
       | > _many insist that C is the programming language and that it
       | will last forever_
       | 
       | but it's 41 years later and c is #2 on
       | https://www.tiobe.com/tiobe-index/, followed by c++, which is
       | almost a superset. items #4, #5, and #6 use c syntax but are
       | high-level languages, and item #7 is a redesign of c as a high-
       | level language with different syntax by, in large part, the bell
       | labs team that designed c in the first place. the #1 item is a
       | high-level language that departs significantly from c syntax, but
       | its almost-universally-used interpreter is written in c
       | 
       | 41 years isn't forever but it's longer than computers had existed
       | in 01983. so that's not a bad showing, especially given the
       | thousands of programming languages that existed before c
       | 
       | ______
       | 
       | (for future reference, the somewhat questionable ranking in the
       | article i linked is currently python, c, c++, java, c#, js,
       | golang, 'visual basic', sql, fortran, delphi/object pascal,
       | assembly language, ruby, swift, scratch, matlab, php, kotlin,
       | rust, and r.)
        
         | phicoh wrote:
         | Yes, both C and Unix are amazing designs. Far from perfect, but
         | good tools for many jobs. In my opinion, it is now time for
         | Rust to take over. But comparing Rust to C, it took a huge
         | amount of improvement over C to replace C.
        
       | Blackstrat wrote:
       | Good article. As of the early 90s, Watcom was by far the best
       | compiler option for professional development on Windows and OS/2.
       | We used both Microsoft and IBM before settling on Watcom. Borland
       | was fun on home PCs, but we didn't approve it for commercial
       | development. Also did a large LAN based system in UCSD-Pascal in
       | the mid-80s. Visual Basic and the Web really ruined my
       | programming desires.
        
       ___________________________________________________________________
       (page generated 2024-05-05 23:00 UTC)