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

6 of 333 comments (clear)

  1. Re:If I were Brian... by AlecC · · Score: 4, Interesting

    int foo, *bar; creates an integer named foo, and a pointer to an int named bar. Right? Or am I wrong?

    So you have one declaration line which created variables of two totally disinct types. Fine for the opriginal creator, lousy for the maintainer, who sees a line declaring ints and had to do a serious double take to find that some of them are actually pointers. Abuse further as

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

    Without reading the line again, what was the type of "up"?

    And as for the other, 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.

    The mistake I would junk is allowing enum {fred=36, bill=19, joe=333} ; Which confuses predefined constants with the classic enumeration. The cost saving of a lookup table to convert the 0, 1, 2 sequence is tiny, and the knock on effects are horrible.

    --
    Consciousness is an illusion caused by an excess of self consciousness.
  2. Re:If I were Brian... by ajs · · Score: 4, Interesting
    You are exactly correct, and I have no idea what the original poster's problem with it was.
    [ajs@put /tmp]$ cat > /tmp/c.c
    #include <stdio.h>
    void
    main(int argc, char *argv[]) {
    int i, *j;
    i = 1;
    *j = 2;
    printf("i=%d, j=%d\n", i, *j);
    exit(0);
    }
    [ajs@put /tmp]$ gcc -o /tmp/c-test /tmp/c.c
    /tmp/c.c: In function `main':
    /tmp/c.c:3: warning: return type of `main' is not `int'
    [ajs@put /tmp]$ /tmp/c-test
    i=1, j=2
    Perhaps he was thinking of "int *i, j" which isn't all that bad in terms of confusion until you started seeing stroustrup's style, which I *hated* from day one of, "int* i" which of course lead to people using, "int* i, j".

    You can write badly obfuscated code by abusing visual association in just about every language, but this particular gotcha should have tipped off Stroustrup VERY early on that his style was agegeously misleading, and a good technical editor should never have let him publish a book with such incomprehensible gibberish.

    That very thing is one of the primary reasons I didn't use C++ for years (not to mention that I regretted it when I did). My thinking was that if the creator of the language didn't see how damaging it was to introduce confusion in his published writing, then he wasn't likely to avoid such in a programming language. I think ANSI C++ stands as a monument to the correctness of my thinking on that point!
  3. Re:expressive by swordgeek · · Score: 3, Interesting

    Forth.

    After years of basic, fortran, 6502 assembler, pascal, and probably something else that I've forgotten, forth was magical. Still is.

    --

    "People who do stupid things with hazardous materials often die." -- Jim Davidson on alt.folklore.urban
  4. Re:If I were Brian... by muffel · · Score: 3, Interesting
    int Foo, *pBar, Flash, *pBang, Up, *pDown, etc;
    yuk. I can only agree with what Linux says in "CodingStyle":
    C is a Spartan language, and so should your naming be. Unlike Modula-2 and Pascal programmers, C programmers do not use cute names like ThisVariableIsATemporaryCounter. A C programmer would call that variable "tmp", which is much easier to write, and not the least more difficult to understand.
    [...]
    Encoding the type of a function into the name (so-called Hungarian notation) is brain damaged - the compiler knows the types anyway and can check those, and it only confuses the programmer. No wonder MicroSoft makes buggy programs.
    --

    bla
  5. these guys by Anonymous Coward · · Score: 5, Interesting

    My aunt used to work with these guys at the Labs here in NJ quite often. Shes dieing now and we sit for hours and talk about how she used to program in C and how much she loved unix. Hours on end of stories about these guys and different projects. I work with a guy now who worked with her, lots of stories from him as well. Awesome stuff, true geniuses. Gotta thank these guys for changing the world.

    -- chris

    http://elusive.filetap.com

  6. Only two real problems in computing? by kbeer · · Score: 3, Interesting

    In the interview KR said:

    There are only two real problems in computing: computers are too hard to use and too hard to program.

    Does everyone buy this? What about issues of availability and maintainability? How about:

    There are three real problems in computing: computers are too hard to use, too hard to program and too hard to administer.