Slashdot Mirror


Linux Journal Interview With Brian Kernighan

pndiku writes "Linux Journal has an interesting interview with Brian Kernighan where he talks about AWK, AMPL and how he had nothing to do with the creation of C."

24 of 333 comments (clear)

  1. expressive by rnd() · · Score: 3, Insightful

    He mentions that he considers C to be the best combination of expressiveness and efficiency. I wonder, fellow Slashdotters, what you think the most expressive language is (efficiency aside)?

    --

    Amazing magic tricks

    1. Re:expressive by GnuVince · · Score: 2, Insightful

      Lisp and Smalltalk are two VERY good languages at being very expressive. And both are old enough to have had enough research that they are now as fast as C++.

    2. Re:expressive by leoboiko · · Score: 3, Insightful
      --
      Prescriptive grammar:linguistics :: alchemy:chemistry. Stop being a nazi and learn some science.
    3. Re:expressive by IamTheRealMike · · Score: 2, Insightful

      Well, define "expressive" first, then maybe people will be able to give better answers....

    4. Re:expressive by turgid · · Score: 2, Insightful

      And both are old enough to have had enough research that they are now as fast as C++.
      I suppose that all depends of the compilers and interpreters involved.

    5. Re:expressive by jfengel · · Score: 5, Insightful

      You've got to be careful with your terminology here. All languages are equally expressive in the sense that anything you compute in one can be written in another. (At least in terms of computability. Access to hardware is a different matter.)

      In your context, you might mean "expressive" in the sense of "saying as much in as few words as possible." Since C is a typed languge with explicit memory management, it's going to be more verbose than an untyped garbage-collecting language like Lisp or Perl. (Well, they have very limited typing, especially once you start adding constructs on top of the core language.)

      Or you could mean "expressive" in exactly the opposite sense, where you have to be more "expressive" about the types of things. In this sense C is far less expressive than strongly typed languages like Haskell or even C++/Java.

      Or you could simply be referring to the verbosity of the language, where COBOL holds the title of most ugly language and APL is without a doubt the shortest. (APL is indistinguishable from line noise.)

      In the end the value of a "language" has less to do with the core language and much to do with the libraries for hardware access (memory, screen, disk, network) and compatibility with common features provided by the OS (clipboard, windowing, etc.)

      So you pick your language for a host of reasons few of which have anything to do with a core "expressiveness".

  2. Great people are so humble! by civilengineer · · Score: 5, Insightful

    He says " I wound up at Princeton" and "through good luck I got a job at Project MAC at MIT" and "probably because of the MIT experience, I got a job at Bell Labs in the Computing Science Research Center". Princeton, MIT, Bell Labs?? not easy!

    --

    New year Resolution: Don't change sig this year
  3. Re:Points in article: by Urkki · · Score: 2, Insightful
    Well, some of your points:

    1. He says the graphical interfaces for running java are more responsive on Windows than X, not that everything is. You take that out of context, and in the process invite flame war Win vs X...

    3. You are inviting a flame war Lisp vs C. They are very different languages to start with, and both have "loyal followers", one of the best recipes for flame war.

    That's why your first post comes through as flamebait, and 2nd post comes through as a troll trying to draw more attention to your first flamebait.

    (And btw, I didn't moderate it, this is just my impression.)

  4. Re:If I were Brian... by parc · · Score: 2, Insightful

    So yeah, where'd that 2 come from? I'm amused that it actually worked, since you define a pointer, then assign to the dereference of it, which is god-only-knows where.

    And void main is deprecated. Don't use it. gcc is nice enough to warn you.

  5. Re:he's dead wrong about MS by SDPlaya · · Score: 3, Insightful

    While your argument may be beginning to hold some weight now, I find your position wrong for most of the history of computers. Historical Microsoft has been on the low-end of the price scale. In fact this is why they are scrambling against Linux, because they've usually been able to beat competitors by undercutting them in price (often destroying markets at the same time). I think you can argue that Microsoft has stifled innovation, but I don't think you can argue that they charge unreasonably high prices. Furthermore, outside of the OS, most other pieces of software are easy to migrate away from. If Microsoft's prices were "unreasonably" high, don't you think someone else would have taken over the Office Suite market by now?

  6. Re:It's official by connsmythe96 · · Score: 2, Insightful

    I've found that most people in my classes who can't program have never even heard of the K&R book, and would probably be hard-pressed to tell you who K&R are. I guess the book can only help if people read it. ;)

    --
    if(!cool) exit(-1);
  7. totally. I like this guy. by rebelcool · · Score: 5, Insightful

    Very practical. He wants to use the computer as a tool. Not a propaganda platform. Windows is fine and dandy for some applications, Unix for others. It all depends on what you're trying to do.

    --

    -

    1. Re:totally. I like this guy. by asciiRider · · Score: 2, Insightful

      It seems to me that alot of "propaganda" and silly things like win32 vs. unix vs. whatever really aren't about the tools themselves, or what the tools can acomplish.

      Sometimes the debates are about the design of the tools.

      I'm pretty sure the Slashdot crowd, given 2 hammers that work well, can argue on and on about which one is "better." Once they've convinced you that one is designed better than the other, they will go on to say "By the way, your poorly designed hammer will do a fine job for you."

      Design and Function are two different things, yet when the debates happen, they often get all mixed up together. Pretty neat to see some of the debates play out anyway though...

  8. Re:If I were Brian... by smittyoneeach · · Score: 3, Insightful

    Yeah, but the variable is just a label. The actual type in question is either int or int*.
    However, you example clearly shows where 'the C++ way' (and I'm one of these who got into coding after C++ was fairly standardized, and so never have done any 'real' C) is not the preferred answer.
    The preferred answer is: knowledge.

    --
    Get thee glass eyes, and, like a scurvy politician, seem to see things thou dost not.--King Lear
  9. Re:If I were Brian... by Zan+Zu+from+Eridu · · Score: 5, Insightful
    So what is wrong with:

    int foo, flash, up, left;
    int *bar, *bang, *down, *right;

    Or even better:

    int foo;
    int flash;
    int up;
    int left;

    int *bar;
    int *bang;
    int *down;
    int *right;

    Just because a language allows a construct doesn't mean you have to use it. This is a coding-style argument, which are of course all subjective.

    I can never define any sort of function pointer in one line: I always have to typedef tthe function and then have a pointer to it. While I can work out, with a manual in hand, how to do it in one line, the syntax is so unintuitive that I never do it: I will just have to reach for the manual again wh en I maintain it.

    This is a valid problem that has to do with operator precedence. In C the operator precedence is arranged in such a way most commonly used expressions can be written without a lot of brackets. I think this is more convenient, because normally you don't define a lot of function pointers, but you do use at least some pointer arithmetics.

    The mistake I would junk is allowing enum {fred=36, bill=19, joe=333} ; Which confuses predefined constants with the classic enumeration.

    A constant in C is not the same as an enum. Simply put constants are addressable, enum items are not. One could choose to introduce yet another construct for unaddressable constants, but this is far more practical.

    And again, you don't have to use every feature in a language just to make your code more interesting. C was designed as a language-of-choice, not as a bondage-and-discipline language. If you don't like your freedom, don't use it, but please don't start whining you've got too much freedom.

  10. Slashdot should retitle the article by Comatose51 · · Score: 4, Insightful

    It should read, "Conversation with God (or a God)".

    Jokes aside, the names Kernighan and Ritchie are firmly planted in the minds of most CS majors. We have "celebrities" like Torvald or Stallman but at the end of the day, professors always say "Read page XXX in Kernighan and Ritchie", which we always proceeds to ignore until our code doesn't work. Then once again, we reach for the pretty little white book and thank someone or something for the well written proses. Unlike many other CS books, K&R seem to have cover most of the possible contingencies a fledgling CS major might have. I hate books that tell you how to do things only in one way, their way. K&R was written so well that I didn't have to.

    --
    EvilCON - Made Famous by /.
  11. Re:If I were Brian... by PD · · Score: 2, Insightful

    Hungarian notation is evil, essentially because it doesn't help the compiler, and it hinders the human programmer. The chunks of letters between two spaces are called words, and if they correspond to words we already know, we recognise them faster. In so many places we've discovered that overloading meanings into a single coded word is a bad idea (think databases). It's no fun trying to decipher a database field that looks like "A45T9923OT" into a thing called "department A4 (paper size) palate T, 99th stack, page 23, Out of the warehouse, on the Truck. Similarly, the type and the name of a variable should be kept completely separate.

  12. Re:he's dead wrong about MS by DunbarTheInept · · Score: 3, Insightful

    Microsoft didn't bring computing to the masses, nor did it hinder it, the HARDWARE platform it was lucky enough to be attached to brought computing to the masses. The openness of the PC hardware made it more affordable than alternatives, and made the hobbiests like it for tinkering, giving the best of both worlds, attracting people BOTH from the 'I want to tinker' camp, and from the 'I want it cheap and don't care about the details' camp. Remember the 80's? The Mac was universally hated by the very same people who today talk about how cool OS/X is for being BSD based. That's because in the '80s the marketplace was driven by people who were willing to learn new software and new languages without even blinking an eye, and so the computer buying decision was driven more by the hardware than the OS that sits on top of it.

    Think about when PC's were becoming popular in the '80s with thousands of titles available for Microsoft DOS. The fact that the OS was DOS was largely irrelevant to those packages. They took over the whole machine when they ran and the OS's job was over once the program was running. So people didn't care that DOS was crap. What mattered is that at a time when the hardware wasn't fast enough to make a real OS feel "snappy", DOS could be shoved aside so your program had the whole CPU and memory to itself. It worked because at the time you couldn't spare the memory and time for a "real" OS.

    DOS was a success because it was attached to PC's, not because of any features of DOS itself.

    --

    Don't label something "offtopic" unless you know the topic well enough to tell what's on topic.

  13. Re:If I were Brian... by Anonymous Coward · · Score: 1, Insightful

    The point was the code has a bug. Following fixes the bug.

    void
    main(int argc, char *argv[]) {
    int i, *j, k;
    i = 1;
    j = & k;
    *j = 2;
    printf("i=%d, j=%d\n", i, *j);
    exit(0);
    }

  14. Re:If I were Brian... by James+Lanfear · · Score: 2, Insightful

    You could also look at it like the pointer j is being assigned the address where the literal 2 is stored.

    No, you couldn't. *j dereferences an uninitialized pointer, which plunges the program into the dark realm of undefined behavior. If j accidentally happened to hold a valid value, and if the compiler saw fit to actually store a 2 somewhere that could be pointed to, then maybe it would appear to work, but you may as well be relying of cosmic rays to flip bits for you.

    Do youself a favor a pick up a copy of the standard, or a book, or anything.

  15. Re:If I were Brian... by Ed+Avis · · Score: 2, Insightful

    The C++ people have some justification for putting the * next to the type name, because of C++'s references.

    string &x;

    &x is a string? Huh? How can the address of x be a string? Of course & does not really mean address-of in the above line, it means a reference to the type.

    string& x;
    string* x;

    Not great, and pretty bad when you have multiple declarations on the same line, but probably better. Stroustrup gives his reasons for preferring this second style.

    --
    -- Ed Avis ed@membled.com
  16. Re:Points in article: by sdowney · · Score: 3, Insightful
    He also co-authored The Elements of Programming Style with P.J.Plauger, and early classic on how, and how not, to program.

    The fact that the language under critque was FORTRAN, unfortunately today, obscures the underlying truths they were discussing.

  17. Re:It's a shared feeling... by Arandir · · Score: 2, Insightful

    It is just easier to use Windows than most other OSes.

    Correction. It is just easier to use Windows software under Windows than most other OSes. But beyond that it's actually pretty mediocre.

    Compare the individual components of Windows to their counterparts in the UNIX world. Compare *just* the window manager part (not the desktop) to Blackbox. Blackbox is easier to use. You can easily control the z-order of windows, snap to window or screen borders, etc., making it very easy to organize your windows on the screen. Now compare *just* the desktop part (not the window manager) to the KDesktop. Under KDE you can use any damn image you want as the wallpaper, and scale it smoothly. You can align you icons to a grid. Multiple desktops are a given. Etc. Now look at task bars. Kicker and Panel kick butt over the Windows taskbar.

    People who have never used any other system always say that Windows is easier than anything else they've tried. And there are so many of them, that people who HAVE used other systems tend to believe them. But it's just not true. It just seems that way because it's what you're used to. Spend a couple of week using something other than Windows, then go back. You'll be surprised.

    p.s. I've never used XP, so it may be a different story, but even CDE seems usable compared to Win9x/NT/2K.

    --
    A Government Is a Body of People, Usually Notably Ungoverned
  18. Re:Holy shit, batman, where's your flame-proof sui by babbage · · Score: 3, Insightful
    In The Power of Myth, Joseph Campbell talks about how among pretty much all religions, the laity & clergy get caught up in how their religion is better than all the others (the classical religious wars). However, most of these religions have a mystical wing -- monks, yogis, etc -- and in general the members of these groups are much more willing to reach out to the other groups and not try to paint things in terms of "us vs. them".

    Kernighan sounds like he applies this kind of perspective to computers. From what I've read, for all the flame wars about Perl vs. Python, Vi vs. Emacs, *NIX vs. Windows, etc, the "monks" in these groups seem to be much more focused on the commonalities among systems rather than the differences between one and another. Kernighan talks about all the languages and operating systems he uses; Larry Wall gleefully puts the best of every language he can get his paws on into Perl; Guido van Rossum doesn't seem to object to letting a future version of Python run on top of Perl6's Parrot runtime engine; Craig Mundie has no fear preaching the Microsoft word at the Open Source Conference; and Tim O'Reilly tells people that he gets along well with all the people he has met at Microsoft.

    I think that's wisdom.