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."
← Back to Stories (view on slashdot.org)
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
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
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.)
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.
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?
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);
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.
-
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
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.
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
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.
If tits were wings it'd be flying around.
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.
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);
}
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.
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
The fact that the language under critque was FORTRAN, unfortunately today, obscures the underlying truths they were discussing.
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
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.
DO NOT LEAVE IT IS NOT REAL