back to article First C compiler pops up on Github

If you have a nostalgic turn of mind, there's a new posting over on Github that you'll just love: the earliest known C compiler by the legendary Dennis Ritchie has been published on the repository. It's not new: long before his death in 2011, Ritchie wrote about the effort to find, recover and preserve the early work on C here …

COMMENTS

This topic is closed for new posts.

Page:

    1. Lee D Silver badge

      Re: First C Compiler

      Yeah, that does catch people out, but there are a lot worse problems running around in all languages (even in C).

      Programming languages were never there to insulate you from your own mistakes until very recently (and with any half-decent C compiler, that will stand out a mile the second you compile it). They were there to interface with a computer that does EXACTLY what you tell it to, every single time. It just made that interface a little easier for humans to manage, not take away all possible delusions that a human could possibly be under about their own code.

      As someone who uses C99 as the language of my choice, I can tell you that I've made that mistake exactly once personally, spot it in other people's code without the need of a compiler, and haven't used a compiler in the last 15 years that DIDN'T generate warnings about it.

      If humans are stupid enough to ignore compiler warnings, they shouldn't even bother with them. Similarly, if a programmer is stupid enough to think that the computer will catch all their mistakes, they should stop programming.

      As my tag on a C forum says:

      "Compiler warnings are like 'Bridge Out Ahead' warnings."

      You can ignore them if you want. I wouldn't recommend it. I haven't yet found a language where it *isn't* possible to shoot yourself in the foot.

      1. Nick Ryan Silver badge

        Re: First C Compiler

        A while ago I had to take over code from somebody who thought that compiler warnings and hints were just a nuisance and therefore turned them off. It took me weeks to get his damn code clear of access violations, accessing objects after deletion, invalid type casts, memory trampling, out of range errors and doubtless a few other nasties as well. This was before I had to deal with merging the operational code with the user interface, a complete non-understanding of threading, serial bus protocols and error handling and a testing side of the application that used entirely different paths of code to the live side.

        On other projects I have come across a couple of genuine cases where the warnings did need to be turned off for a small section of code, as the compiler was producing an invalid warning and coding around the compiler just to remove a warning is not an entirely sensible technique. This requirement was clearly documented in the code, which at least excuses the practice for the small section of code that it was required for.

    2. Steen Hive
      Stop

      Re: First C Compiler

      "I can use = instead of == in an expression and that's valid?"

      Of course you can - just like a+b and a-b are both "valid". Programming languages don't really have to care about your personal dyslexia.

    3. Yag

      Re: First C Compiler

      Yes, it is valid.

      This section of code :

      if(error_occured = MyFunction())

      {

      // Error management

      }

      else

      {

      // Nominal case

      }

      is equivalent to :

      error_occured = MyFunction();

      if(error_occured == true)

      {

      // Error management

      }

      else

      {

      // Nominal case

      }

      Both are valid, and have the same functional behaviour as long as MyFunction() returns a boolean. (unless I forgot a semicolon somewhere, it's getting late...)

      The first one is often prefered by some people because it looks smarter and may be a bit more optimized depending of your compiler.

      I find the second one better because it's easier to understand, reuse, maintain and debug.

      However, the use of one form or the other is not even a personnal choice, but mostly a matter of the purpose of the code. For large projects spanning years and dozen of people, the second version is strongly recommanded. The first version might even be forbidden by corporate coding standards.

    4. Michael Wojcik Silver badge

      Re: First C Compiler

      the great grandmother of all compiler errors

      There's no "compiler error" there. There's a feature of the language, which the compiler implements correctly. You could argue that the language design is flawed for including such a feature - and many people have, ad nauseum, so please don't bother. But the compiler is doing precisely what it's supposed to be doing.

  1. horse of a different color
    Mushroom

    No link to github repo?

    Seems like a massive omission in the article.

    1. Destroy All Monsters Silver badge
      Thumb Up

      Re: No link to github repo?

      Correct. First post remedies this.

  2. Rusty 1
    Go

    Engraving

    This code should be engraved on a plaque on the next interstellar probe that mankind sends off to explore the universe. Any aliens seeing it will discover that we were not afraid to wrangle pointers and all that that entails so far back in our history. We will be recognised as the gnarly dudes we surely are.

    1. Phil O'Sophical Silver badge
      Alien

      Re: Engraving

      > We will be recognised as the gnarly dudes we surely are.

      After they've stopped killing themselves laughing at the thought that we didn't then yet know that we were about to inflict object-oriented programming in Java on ourselves...

      1. Destroy All Monsters Silver badge

        Re: Engraving

        > object-oriented programming in Java

        It is sufficiently nice and complaining about it is for pseudo-toughs. Like retarded colonels that need a good fragging phoning in will-to-power-bring-me-my-medal orders to the front lines.

        Really, it frees you up for the NEXT gnarly problems, like programs that navigate in the real world, or actually delivering stuff through the bureaucratic maze of a company.

        1. Nigel 11
          Mushroom

          Re: Engraving

          I'm reminded of the USA experts laughing at the USSR's avionics in a defector's jet, that still used thermionic valves (tiny peanut-sized ones).

          Until someone pointed out that valves are EMP-proof, and transistors aren't.

      2. Rusty 1
        Childcatcher

        Re: Engraving

        What is this "object oriented" coffee of which you speak?

        Good programming certainly does involves coffee, with a few side orders of pizza (or curry, or horse, according to taste). And from time to time, also pointers, heap allocations, structs, and other maniacal constructs. But I am at a complete loss as to where the orientation of objects comes into this. Is this "Java" business all about homogenous objects? Or is there general acceptance of heterogenous objects? What about happy objects? Or those objects that are really unusual, or a bit queer?

        I'm confused and I think I shall go back to assembler in a dark room.

    2. Anonymous Coward
      Anonymous Coward

      Re: Engraving

      Bliss?

      1. PhilBuk
        Headmaster

        Re: Engraving

        @AC 13:12

        There was a BLISS-11 but it was only really used a lot inside DEC.

        Phil.

        1. Anonymous Coward
          Anonymous Coward

          Re: Engraving

          Wasn't there a Bliss32 for VAXen as well?

          1. Anonymous Coward
            Anonymous Coward

            Bliss[32] (Was: Re: Engraving)

            There was indeed Bliss32 for VAXen but my point was really in reply to the poster who waxed about pointers. If my dim memory serves me correctly, everything in Bliss is a pointer.

    3. Yag
      Joke

      Re: Engraving

      Is this a really good idea to give them the key to hack our computers? A reversed "Independance day" gambit is not that smart...

      Wait...

      The original "Independance day" gambit was even dumber.

  3. Michael H.F. Wilkinson Silver badge
    Thumb Up

    Neat!!

    I will post a link for our students in the history of computing section of our Orientation in Computer Science course.

  4. Dave 32
    Coat

    PDP-11

    Drat, I gave away my PDP-11/03 decade or two ago. Of course, it was only a /03 model, designed for industrial process control, and, as such, only had 4K (or so) of RAM. Plus, it didn't have a fancy blinking-light console, instead being relegated to a dual gray box. But, it was a cute machine. About killed myself lugging those Rx-05 drives down to the basement.

    Hmm, isn't there a PDP-11 simulator available out there somewhere? And, I have a feeling that the simulator probably runs faster than the real PDP-11.

    Dave

    P.S. I'll get my coat; It's the one with the paper tape in the pocket.

  5. Dave 32
    Coat

    Compilers in their own language

    I have worked on a compiler that was written in its own language (one of the infamous PL/x compilers, see wikipedia). Having a compiler compile itself was an excellent test of the compiler. Can't say much more about it, though.

    Dave

    P.S. I'll get my coat. It's the one with the punched cards in the pocket.

  6. 6 inches long, handle.

    Nicey!

    Now, where did I put that Linux Kernel v0.01 archive?

Page:

This topic is closed for new posts.

Other stories you might like