* Re: Wildfire and NT @ 1998-02-23 5:00 Robert Harley 1998-02-24 5:00 ` brianh 0 siblings, 1 reply; 53+ messages in thread From: Robert Harley @ 1998-02-23 5:00 UTC (permalink / raw) brianh@bit3.com writes: >[...] >Speaking from painful, personal experience, writing a 30,000 line program is >a vastly different undertaking than writing a 3,000 line program. However a talented programmer will write a 30,000 line program that fits in 3,000 lines. >And writing a 300,000 line program is probably a completely different >undertaking than writing a 30,000 line program. That presumably requires a large team of monkeys being paid according to some software metric (that a random $200/hour consultant yanked out of his ass). >Don't overestimate the importance of the personal computer experience. It all depends on what was derived from that experience: one guy will have acquired "the right stuff" while another will have memorized some Windoze API... Rob. "grad hamster" H. ^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: Wildfire and NT 1998-02-23 5:00 Wildfire and NT Robert Harley @ 1998-02-24 5:00 ` brianh 1998-02-24 5:00 ` David Hinds ` (4 more replies) 0 siblings, 5 replies; 53+ messages in thread From: brianh @ 1998-02-24 5:00 UTC (permalink / raw) In article <6csl81$rb9@news-rocq.inria.fr>, Robert Harley <harley@pauillac.inria.fr> wrote: >brianh@bit3.com writes: >>[...] >>Speaking from painful, personal experience, writing a 30,000 line program is >>a vastly different undertaking than writing a 3,000 line program. > >However a talented programmer will write a 30,000 line program that >fits in 3,000 lines. *Bzzt* Thank you for playing, but that answer is incorrect. If you feel the need to disagree, please post the 3,000 line program that delivers the same functionality of the Linux kernel. > >>And writing a 300,000 line program is probably a completely different >>undertaking than writing a 30,000 line program. > >That presumably requires a large team of monkeys being paid according >to some software metric (that a random $200/hour consultant yanked out >of his ass). Getting that large team of monkeys to produce something that works is quite the trick. > > >>Don't overestimate the importance of the personal computer experience. > >It all depends on what was derived from that experience: one guy will >have acquired "the right stuff" while another will have memorized some >Windoze API... I held a lot of the same opinions in my younger days that a lot of the young hackers hold. For example, comments are for dweebs who can't read code. And then I encountered the Real World (tm). And had several epiphanies. > >Rob. "grad hamster" H. > I don't speak for Bit 3. Brian ^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: Wildfire and NT 1998-02-24 5:00 ` brianh @ 1998-02-24 5:00 ` David Hinds 1998-02-25 5:00 ` Del Cecchi 1998-02-25 5:00 ` brianh 1998-02-24 5:00 ` Bill Moyer ` (3 subsequent siblings) 4 siblings, 2 replies; 53+ messages in thread From: David Hinds @ 1998-02-24 5:00 UTC (permalink / raw) brianh@bit3.com wrote: : > : >However a talented programmer will write a 30,000 line program that : >fits in 3,000 lines. : : *Bzzt* Thank you for playing, but that answer is incorrect. : : If you feel the need to disagree, please post the 3,000 line program that : delivers the same functionality of the Linux kernel. Your "counterexample" is only relevant if you assume that the Linux kernel wasn't written by talented programmers in the first place. Going in the other direction, I'm sure that people could think of things with 10 times as many lines as the Linux kernel, but with less functionality. -- Dave Hinds ^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: Wildfire and NT 1998-02-24 5:00 ` David Hinds @ 1998-02-25 5:00 ` Del Cecchi 1998-02-25 5:00 ` brianh 1 sibling, 0 replies; 53+ messages in thread From: Del Cecchi @ 1998-02-25 5:00 UTC (permalink / raw) In article <6cvgl7$5kb$3@nntp.Stanford.EDU>, dhinds@zen.stanford.edu (David Hinds) writes: |> brianh@bit3.com wrote: |> : > |> : >However a talented programmer will write a 30,000 line program that |> : >fits in 3,000 lines. |> : |> : *Bzzt* Thank you for playing, but that answer is incorrect. |> : |> : If you feel the need to disagree, please post the 3,000 line program that |> : delivers the same functionality of the Linux kernel. |> |> Your "counterexample" is only relevant if you assume that the Linux |> kernel wasn't written by talented programmers in the first place. |> |> Going in the other direction, I'm sure that people could think of |> things with 10 times as many lines as the Linux kernel, but with less |> functionality. |> |> -- Dave Hinds And of course if the talented programmer wrote in APL it would only take 1 line... :-) :-) -- Del Cecchi cecchi@rchland ^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: Wildfire and NT 1998-02-24 5:00 ` David Hinds 1998-02-25 5:00 ` Del Cecchi @ 1998-02-25 5:00 ` brianh 1 sibling, 0 replies; 53+ messages in thread From: brianh @ 1998-02-25 5:00 UTC (permalink / raw) In article <6cvgl7$5kb$3@nntp.Stanford.EDU>, David Hinds <dhinds@zen.stanford.edu> wrote: >brianh@bit3.com wrote: >: > >: >However a talented programmer will write a 30,000 line program that >: >fits in 3,000 lines. >: >: *Bzzt* Thank you for playing, but that answer is incorrect. >: >: If you feel the need to disagree, please post the 3,000 line program that >: delivers the same functionality of the Linux kernel. > >Your "counterexample" is only relevant if you assume that the Linux >kernel wasn't written by talented programmers in the first place. The original poster (the attribution seems to have disappeared) sounded like he was saying that every 30,000 line program could be a 3,000 line program if it was just written by a talented enough programmer. Yes, incompetance can lead to serious code bloat (turning 3,000 line programs into 30,000 line programs), but there are 30,000 line programs which are well written by talented people, and could not be turned into equivelent 3,000 line programs at the current state of the art. Moving from assembly to C reduces the lines of code required for "equivelent" programs by at least a factor of 3- so the ~300,000 line Linux kernel in C would require ~1,000,000 lines (or more) of assembly- so advances in the state of the art reduce the number of lines of code required for the same program. However, the number and complexity of features advance at the same time (if not before)- consider the complexity difference going from a text-based word processor to a GUI WYSIWYG word processor. > >Going in the other direction, I'm sure that people could think of >things with 10 times as many lines as the Linux kernel, but with less >functionality. > >-- Dave Hinds I don't speak for Bit 3. Brian ^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: Wildfire and NT 1998-02-24 5:00 ` brianh 1998-02-24 5:00 ` David Hinds @ 1998-02-24 5:00 ` Bill Moyer 1998-02-25 5:00 ` Larry Kilgallen 1998-02-25 5:00 ` Wildfire and NT John Hascall 1998-02-24 5:00 ` Sean Burke ` (2 subsequent siblings) 4 siblings, 2 replies; 53+ messages in thread From: Bill Moyer @ 1998-02-24 5:00 UTC (permalink / raw) In article <Eow2yu.F8p@bit3.com> brianh@bit3.com writes: > >I held a lot of the same opinions in my younger days that a lot of the >young hackers hold. For example, comments are for dweebs who can't read >code. And then I encountered the Real World (tm). And had several >epiphanies. I wish I'd run into the same experience .. as a young programmer, I got the importance of useful comments drilled into my head, and when I started working on commercial code I'd suddenly find more-senior engin- eers telling me to cut most of my comments. I'm still getting some of that. -- Bill Moyer -- ^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: Wildfire and NT 1998-02-24 5:00 ` Bill Moyer @ 1998-02-25 5:00 ` Larry Kilgallen 1998-02-25 5:00 ` brianh 1998-02-25 5:00 ` Wildfire and NT John Hascall 1 sibling, 1 reply; 53+ messages in thread From: Larry Kilgallen @ 1998-02-25 5:00 UTC (permalink / raw) In article <6cvbvu$55c$1@andros.cygnus.com>, billm@cygnus.com (Bill Moyer) writes: > I wish I'd run into the same experience .. as a young programmer, I > got the importance of useful comments drilled into my head, and when I > started working on commercial code I'd suddenly find more-senior engin- > eers telling me to cut most of my comments. I'm still getting some of > that. Well they aren't more-senior-enough, as they apparently have never gone back to maintain code they had written 8 years ago. Larry Kilgallen ^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: Wildfire and NT 1998-02-25 5:00 ` Larry Kilgallen @ 1998-02-25 5:00 ` brianh 1998-02-25 5:00 ` Epiphanies (was: Wildfire and NT) Carlie Coats 0 siblings, 1 reply; 53+ messages in thread From: brianh @ 1998-02-25 5:00 UTC (permalink / raw) In article <1998Feb24.204936.1@eisner>, Larry Kilgallen <Kilgallen@eisner.decus.org.nospam> wrote: >In article <6cvbvu$55c$1@andros.cygnus.com>, billm@cygnus.com (Bill Moyer) writes: > >> I wish I'd run into the same experience .. as a young programmer, I >> got the importance of useful comments drilled into my head, and when I >> started working on commercial code I'd suddenly find more-senior engin- >> eers telling me to cut most of my comments. I'm still getting some of >> that. > >Well they aren't more-senior-enough, as they apparently have never gone >back to maintain code they had written 8 years ago. At least one of my epiphanies came when I went back to maintain some code I had written six months previously. It might as well have been written by the guy who had left the company several year previously (actually, I might have had a better crack at understanding it in that case...). I don't speak for Bit 3. Brian ^ permalink raw reply [flat|nested] 53+ messages in thread
* Epiphanies (was: Wildfire and NT) 1998-02-25 5:00 ` brianh @ 1998-02-25 5:00 ` Carlie Coats 0 siblings, 0 replies; 53+ messages in thread From: Carlie Coats @ 1998-02-25 5:00 UTC (permalink / raw) In article <EoxypD.Ez1@bit3.com>, <brianh@bit3.com> wrote: : In article <1998Feb24.204936.1@eisner>, : Larry Kilgallen <Kilgallen@eisner.decus.org.nospam> wrote: : >In article <6cvbvu$55c$1@andros.cygnus.com>, billm@cygnus.com (Bill Moyer) writes: ... : >Well they aren't more-senior-enough, as they apparently have never gone : >back to maintain code they had written 8 years ago. : : At least one of my epiphanies came when I went back to maintain some code : I had written six months previously. It might as well have been written : by the guy who had left the company several year previously (actually, I : might have had a better crack at understanding it in that case...). According to E.T.Bell (_Men of Mathematics_), the original discoverer of this was Laplace over 200 years ago, when he came back to some 4-month-old celestial mechanics calculations... ^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: Wildfire and NT 1998-02-24 5:00 ` Bill Moyer 1998-02-25 5:00 ` Larry Kilgallen @ 1998-02-25 5:00 ` John Hascall 1998-02-25 5:00 ` Rob Rodgers 1 sibling, 1 reply; 53+ messages in thread From: John Hascall @ 1998-02-25 5:00 UTC (permalink / raw) Bill Moyer <billm@cygnus.com> wrote: }brianh@bit3.com writes: }>I held a lot of the same opinions in my younger days that a lot of the }>young hackers hold. For example, comments are for dweebs who can't read }>code. And then I encountered the Real World (tm). And had several }>epiphanies. } I wish I'd run into the same experience .. as a young programmer, I }got the importance of useful comments drilled into my head, and when I }started working on commercial code I'd suddenly find more-senior engin- }eers telling me to cut most of my comments. "In all things, moderation". ; ; In my ye olde days of mainframes, there was ; a big piece of code I worked on which had ; a tendency to massive comments blocks ; which would in great detail explain what ; the next few (or three or two or one!) ; lines of code were for even if it was ; not particularly disobvious. ; for (e = x; am < pl; ++e) { ; ; Personally, I found it hard to get 'enough' ; of the program in front of my eyes to grasp ; what was going on 'in the big picture'. ; am = p(l,e); ; ; Now, perhaps I am just wierd in this regard. ; And perhaps I'm just brainwashed by my early ; education which was that if a function is ; bigger than a page, split it up. ; pl = ea(s,e); ; ; Similarly, people who use small tab stops, ; and wide screens (or heaven forbid letting ; lines wrap all willy nilly) so they can have ; eleventy-dozen levels of nesting. Argh! ; if (am) { ++pl; } else { --e; } ; ; Heaven help me for opening this can of worms, ; but I also have the same problem (in C) with the ; 'super-airy, each brace deserves it's own line style'. ; am ? ++pl : --e; ; ; Well, that's my 2c worth. ; } ; ; Like anyone cares. ; John -- John Hascall, Software Engr. Shut up, be happy. The conveniences you ISU Computation Center demanded are now mandatory. -Jello Biafra mailto:john@iastate.edu http://www.cc.iastate.edu/staff/systems/john/welcome.html <-- the usual crud ^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: Wildfire and NT 1998-02-25 5:00 ` Wildfire and NT John Hascall @ 1998-02-25 5:00 ` Rob Rodgers 0 siblings, 0 replies; 53+ messages in thread From: Rob Rodgers @ 1998-02-25 5:00 UTC (permalink / raw) john@iastate.edu (John Hascall) wrote: > "In all things, moderation". One solution to comments (both too many and too few) is a more sophisticated editor, e.g., one which can show or hide block comments, single line comments, or just show the first one to three lines of a multi-line comment block. ^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: Wildfire and NT 1998-02-24 5:00 ` brianh 1998-02-24 5:00 ` David Hinds 1998-02-24 5:00 ` Bill Moyer @ 1998-02-24 5:00 ` Sean Burke 1998-02-25 5:00 ` brianh ` (3 more replies) 1998-02-25 5:00 ` Bernd Paysan 1998-02-27 5:00 ` Paul Kahler 4 siblings, 4 replies; 53+ messages in thread From: Sean Burke @ 1998-02-24 5:00 UTC (permalink / raw) brianh@bit3.com wrote: > > In article <6csl81$rb9@news-rocq.inria.fr>, > Robert Harley <harley@pauillac.inria.fr> wrote: > >brianh@bit3.com writes: > > > >>Don't overestimate the importance of the personal computer experience. > > > >It all depends on what was derived from that experience: one guy will > >have acquired "the right stuff" while another will have memorized some > >Windoze API... > > I held a lot of the same opinions in my younger days that a lot of the > young hackers hold. For example, comments are for dweebs who can't read > code. And then I encountered the Real World (tm). And had several > epiphanies. Nevertheless, I think there have been some tangible changes in coding style over the last few years. Back in the eighties, good programming meant getting the most out of arrays. For fast access and low overhead, you just can't beat 'em. The BSD kernel had a fixed set of proc entries, the C library had bsearch() and qsort(). If you did a code walkthrough, people would point out calls to malloc(), and tell you it was an expensive call. Header files had constants for MAX_NUM_this_or_that, and programs had configuration files where you sized various tables. Today, we use malloc'ed objects, storing the pointers in linked-lists, btrees and hash tables. These data structures come with a lot of overhead both in space and time - malloc overhead, pointer-indirection, etc. But they are more flexible than arrays, and in modern systems, the overhead just isn't often noticeable. One of the tenets of "modern" coding is to avoid any kind of fixed limitations in one's code. (I recently was annoyed to discover that a certain C compiler would not handle literal strings over 32K bytes - imagine! :^) Was the old style better? Well, there's nothing like running yesterday's software on today's machines - one reason the BSD system is so popular today. Perhaps our code will in turn be described as "lean-n-mean" by those who follow us. But don't bet on it. In the Mac world, the term "byte-squeaking pinheadery" has been applied to some of the brilliant coding that enabled the original MacOS to run in 128K. -SEan (Think about it - OS, window system, and even space left to run a simple word processor, in 128K! Boggles the mind, doesn't it? ) ^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: Wildfire and NT 1998-02-24 5:00 ` Sean Burke @ 1998-02-25 5:00 ` brianh 1998-02-25 5:00 ` Mike Albaugh ` (2 subsequent siblings) 3 siblings, 0 replies; 53+ messages in thread From: brianh @ 1998-02-25 5:00 UTC (permalink / raw) In article <34F3B7C5.5FD1@earthlink.net>, Sean Burke <Iburke@earthlink.net> wrote: > >Was the old style better? Well, there's nothing like running >yesterday's software on today's machines - one reason the BSD >system is so popular today. Perhaps our code will in turn be >described as "lean-n-mean" by those who follow us. But don't >bet on it. In the Mac world, the term "byte-squeaking pinheadery" >has been applied to some of the brilliant coding that enabled >the original MacOS to run in 128K. > Such brilliant coding has (and I have been lead to beleive) caused real problems in maintainance. The "brilliant hacks" which allowd you to shoehorn a GUI OS into 128K in 1984 are the "Backwards compatibility nightmares" of 1998. This is one of the things I learned the hard way- in my golden youth and college days, I never had to go back and maintain software, and (at least in college) I (occasionally) got extra points for unrequested feeping creaturism (and I never got docked for it). By making the code unnecessarily complex, however, I made the later code maintainance a nightmare, and one of the reasons why having to maintain my own code six months later caused an epiphany ("Unneeded complexity is bad"). In the case of the Mac, I can't call it. Was fitting it into 128K absolutely required? Would the Mac have died if it had debuted for $500 more with 256K? I don't know. There is some evidence that this might actually have been the case- the NeXT debuted with system requirements that weren't 'cheap' for another several years (68040 w/8M of memory). This is one of the generally accepted reasons why it died. >-SEan > >(Think about it - OS, window system, and even space left to run > a simple word processor, in 128K! Boggles the mind, doesn't it? ) Yes, especially the people that claim this should be a requirement in the era where most computers have more L2 cache than this. Computing power does change, and this changes the implicit requirements- limiting strings to 32K on a system with only 128K of memory may make sense- on a system with 128M of memory (and another 512M of swap), it's kinda ridiculus. Which is the greater crime- requiring the computing power be available, or not taking advantage of the computing power that is available? I don't speak for Bit 3. Brian ^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: Wildfire and NT 1998-02-24 5:00 ` Sean Burke 1998-02-25 5:00 ` brianh @ 1998-02-25 5:00 ` Mike Albaugh 1998-02-25 5:00 ` [++] Tight coding (Was: Re: Wildfire and NT) Terje Mathisen 1998-02-25 5:00 ` Wildfire and NT Maynard Handley 3 siblings, 0 replies; 53+ messages in thread From: Mike Albaugh @ 1998-02-25 5:00 UTC (permalink / raw) I _was_ just going to reply, but apparently the header is wedged. Oh, well, you comp.arch guys are used to my ramblings and the rest of you might consider: (Note, I trimmed the followups) Sean Burke (Iburke@earthlink.net) wrote: : Today, we use malloc'ed objects, storing the pointers in linked-lists, : btrees and hash tables. These data structures come with a lot of : overhead both in space and time - malloc overhead, pointer-indirection, : etc. But they are more flexible than arrays, and in modern systems, : the overhead just isn't often noticeable. Of course, this is also not as reliable, especially if, as is still _way_ too common, the programmer ignores the possibility of a NULL return value from malloc, or the system "overcommits" swap space in an attempt to push that NULL return further into the future. The symptoms of this disease are exactly what we see in "modern" software, random crashes for no apparent reason, well past the initial cause, rather than that annoying old "I can't do that for you right now" sort of error message. Better? Well, obviously so, since the market has voted for it. I just can't wait until the Air Route Traffic Control (or Flight Management) software is re-written to such modern standards... :-) BTW, "exceptions" are not so clearly "the answer" either, since they may force some pretty sophisticatd "post mortem" code to be run in what, by definition, is an "exceptional" (hence, probably lightly exercised and more likely to have bugs) circumstance. TANSTAAFL. Mike | albaugh@agames.com, speaking only for myself ^ permalink raw reply [flat|nested] 53+ messages in thread
* [++] Tight coding (Was: Re: Wildfire and NT) 1998-02-24 5:00 ` Sean Burke 1998-02-25 5:00 ` brianh 1998-02-25 5:00 ` Mike Albaugh @ 1998-02-25 5:00 ` Terje Mathisen 1998-02-28 5:00 ` Piercarlo Grandi 1998-03-01 5:00 ` [++] Tight coding Bill Moyer 1998-02-25 5:00 ` Wildfire and NT Maynard Handley 3 siblings, 2 replies; 53+ messages in thread From: Terje Mathisen @ 1998-02-25 5:00 UTC (permalink / raw) Sean Burke wrote: > system is so popular today. Perhaps our code will in turn be > described as "lean-n-mean" by those who follow us. But don't > bet on it. In the Mac world, the term "byte-squeaking pinheadery" > has been applied to some of the brilliant coding that enabled > the original MacOS to run in 128K. > > -SEan > > (Think about it - OS, window system, and even space left to run > a simple word processor, in 128K! Boggles the mind, doesn't it? ) Another example: The original Turbo Pascal 1.0: This program used a total of 35kB (37 if you allowed textual error messages instead of just numbers), and contained a full-screen editor (using WordStar keys), a compiler/linker(/debugger?), as well as the full runtime library. I still believe this must rank as one of the best hacks ever (written by Anders Heilsberg, the dane). Terje -- - <Terje.Mathisen@hda.hydro.com> Using self-discipline, see http://www.eiffel.com/discipline "almost all programming can be viewed as an exercise in caching" ^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: [++] Tight coding (Was: Re: Wildfire and NT) 1998-02-25 5:00 ` [++] Tight coding (Was: Re: Wildfire and NT) Terje Mathisen @ 1998-02-28 5:00 ` Piercarlo Grandi 1998-03-01 5:00 ` [++] Tight coding Bill Moyer 1 sibling, 0 replies; 53+ messages in thread From: Piercarlo Grandi @ 1998-02-28 5:00 UTC (permalink / raw) >>> On Wed, 25 Feb 1998 21:59:18 +0000, Terje Mathisen >>> <Terje.Mathisen@hda.hydro.com> said: Terje.Mathisen> Sean Burke wrote: Sean> system is so popular today. Perhaps our code will in turn be Sean> described as "lean-n-mean" by those who follow us. But don't Sean> bet on it. In the Mac world, the term "byte-squeaking pinheadery" Sean> has been applied to some of the brilliant coding that enabled Sean> the original MacOS to run in 128K. Sean> -SEan Sean> (Think about it - OS, window system, and even space left to run Sean> a simple word processor, in 128K! Boggles the mind, doesn't it? ) Yes, but it was really tight and it did run awfully slowly, and functionality was next to terrible. Well coded graphics toolbox, yes, but that not an OS make. Terje.Mathisen> Another example: The original Turbo Pascal 1.0: This Terje.Mathisen> program used a total of 35kB (37 if you allowed textual Terje.Mathisen> error messages instead of just numbers), and contained a Terje.Mathisen> full-screen editor (using WordStar keys), a Terje.Mathisen> compiler/linker(/debugger?), as well as the full runtime Terje.Mathisen> library. Well, what about the original PDP-11 version of UNIX, of which the best examples were V7 and 2.xBSD? The kernel occupied less than 64KB, and it could run a single user, with multiple processes, rather well in 128KB total memory, and even two users could be accomodated rather decently in the same amount of memory, with some swapping. Not difficult to do when process size is typically 8-32KB. I used to run three concurrent users on a 256KB PDP-11/34B, doing serious development work, usually two of them editing with VI and one compiling with the make and PCC. This was by no means heroic: it was how it was designed to run, and it run well. And what about the version of UNIX/Xenix by IBM that somehow managed to run on an 8088 (atrociously slowly)? And all those 286s with SCO Xenix that could run a dozen users using an accounting package in 1MB total RAM? Terje.Mathisen> I still believe this must rank as one of the best hacks Terje.Mathisen> ever (written by Anders Heilsberg, the dane). Uh, it reminds me of a story by Dijkstra, that goes more or less like this: that he had gone to a language implementation conference in the USA, as he had done an Algol 60 compiler and had written a paper about it. He said that the first speaker described his FORTRAN compiler, that was 50,000 lines long, which the audience quite liked. The next guy then introduced his COBOL compiler, claiming that it was 250,000 lines long, and the audience clapped in appreciation. The next guy then smugly announced that his PL/1 compiler was 1,000,000 lines of code, and then the audience gave him an ovation. At that point he had to speak himself and he was very embarassed as he announced that his ALGOL 60 compiler was very fast and generated good code and as bug free as far as they could see, however it was only 5,000 lines long, and the audience almost booed him. American programmers :-). ^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: [++] Tight coding 1998-02-25 5:00 ` [++] Tight coding (Was: Re: Wildfire and NT) Terje Mathisen 1998-02-28 5:00 ` Piercarlo Grandi @ 1998-03-01 5:00 ` Bill Moyer 1998-03-01 5:00 ` Ruud Bruijnesteijn ` (2 more replies) 1 sibling, 3 replies; 53+ messages in thread From: Bill Moyer @ 1998-03-01 5:00 UTC (permalink / raw) Sean Burke wrote: > >Sean> system is so popular today. Perhaps our code will in turn be >Sean> described as "lean-n-mean" by those who follow us. But don't >Sean> bet on it. In the Mac world, the term "byte-squeaking pinheadery" >Sean> has been applied to some of the brilliant coding that enabled >Sean> the original MacOS to run in 128K. I occasionally wonder if (or when) software will become suf- ficiently massive and complex that system performance will be dominated by the frequency and time it takes to recover from application (or system) crashes. If this happened, upgrading to faster hardware would not effectively improve productivity. There have already been some halfhearted attempts to solve the problems of increasing program complexity by application of object-oriented techniques, but the more I see the object oriented style fail to live up to its promises, the more I think that techniques discarded in the past for being slow, inconvenient, or impractical (memory segmentation with bounds checking, strong type checking, compile-time proving of code correctness, et al) might be worth another look. Run-time bounds checking increases the processor power required to run applications, but applications which are bottlenecked by crash frequency (eg, programmer error in pointer arithmetic) would benefit from it. Use of memory segmentation would help pin- point which data structure (or catagory of data structures) was corrupted, and allow recovery routines to perhaps repair the damage and continue with application execution; this would be a big improvement over "Segmentation Fault; core dumped" or "GPF 314159". Relying on run-time capture and correction of errors bugs the hell out of me. Like most programmers, I believe that programming errors should be caught and corrected before a product ships, but the current practice of shipping products with dozens or hundreds of *known* bugs does not show any sign of changing. Changing the programming language to improve compile-time verification of code correctness (with richer and stronger types, richer static semantic sets, and compile-time range tracking) would locate more bugs at compile-time, reduce the number of bugs in a "finished" product, and reduce the overall time spent in the development cycle (because finding run-time bugs is a much longer and more laborious task than finding them at compile-time). It has been proven that the imperative languages are not provable (ie, for any turing-complete imper- ative language, a program can be written which is not provably correct or incorrect), but it is still possible to improve provability by degrees, and we can do a lot better than C. -- Bill Moyer ^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: [++] Tight coding 1998-03-01 5:00 ` [++] Tight coding Bill Moyer @ 1998-03-01 5:00 ` Ruud Bruijnesteijn 1998-03-01 5:00 ` scott 1998-03-01 5:00 ` Larry Kilgallen 1998-03-02 5:00 ` [++] Tight coding Peter Moylan 2 siblings, 1 reply; 53+ messages in thread From: Ruud Bruijnesteijn @ 1998-03-01 5:00 UTC (permalink / raw) Bill Moyer wrote: > > I occasionally wonder if (or when) software will become suf- > ficiently massive and complex that system performance will be > dominated by the frequency and time it takes to recover from > application (or system) crashes. If this happened, upgrading > to faster hardware would not effectively improve productivity. I think (hope) some products (notably WinXX, Adobe, Nutscrape) will reach that state before the end of the century. <SNIP> > the more I > think that techniques discarded in the past for being slow, > inconvenient, or impractical (memory segmentation with bounds > checking, strong type checking, compile-time proving of code > correctness, et al) might be worth another look. <SNIP> I think what you are forgetting here is a re-evaluation of the basic programming principles that were outlined in the 70s and 80s. For some reason I have the impression that the bulk of so-called programmers have no notion of what an Invariant is, what Pre- or Postconditions are, and why these are such important elements in programming. > Changing the programming language to improve compile-time > verification of code correctness (with richer and stronger > types, richer static semantic sets, and compile-time range > tracking) would locate more bugs at compile-time, reduce the > number of bugs in a "finished" product, and reduce the overall > time spent in the development cycle (because finding run-time > bugs is a much longer and more laborious task than finding > them at compile-time). It has been proven that the imperative > languages are not provable (ie, for any turing-complete imper- > ative language, a program can be written which is not provably > correct or incorrect), but it is still possible to improve > provability by degrees, and we can do a lot better than C. Hmm. I think you're right from a pure theoretical point of view, and in fact practice is that most programs are impossible to prove. However, the fact that programs can be written that can not be proven, does not exclude the possibility that there are programs that can! It's 'a discipline of programming' ;-) Algorithms can be proven, (if you can't prove it, it's not an algorithm!) but the step from algorithm to implementation (the 'mapping') is a sore point. But you're right that all a strickt language can do to help is to improve the chances to catch an error. However, Did you take look at the work by Mishra and Mani Chandri in Austin on the provability of software, and the formal descriptional method they call UNITY. Have you looked at Component Pascal (Oberon-2, BlackBox) for a real neat modern approach? It's not perfect, but it sure is a step in the right direction, I think. -- Ruud Bruijnesteijn SDS Sport.Data.Systems GmbH http://www.sds-sportdata.com ^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: [++] Tight coding 1998-03-01 5:00 ` Ruud Bruijnesteijn @ 1998-03-01 5:00 ` scott 1998-03-02 5:00 ` Terry Moore ` (2 more replies) 0 siblings, 3 replies; 53+ messages in thread From: scott @ 1998-03-01 5:00 UTC (permalink / raw) The best refutation of proofs for programs is in Peter van der Linden's Deep C Secrets. He shows a page from such a proof, which is incomprehensible to anyone other than a theoretical mathematician, and then describes a Usenet flame war about an error in a proof. There are not enough programmers to go around, and requiring mathematicians to prove programs on top of them will never work. The only hope we have is "black box" object programming, where an object is just a plug-in component. It will either work reliably, or can be replaced if it does not. Scott -- Look at Softbase Systems' client/server tools, www.softbase.com Check out the Essential 97 package for Windows 95 www.skwc.com/essent All my other cool web pages are available from that site too! My demo tape, artwork, poetry, The Windows 95 Book FAQ, and more. ^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: [++] Tight coding 1998-03-01 5:00 ` scott @ 1998-03-02 5:00 ` Terry Moore 1998-03-02 5:00 ` Pete Becker 1998-03-02 5:00 ` Kaz Kylheku 1998-03-02 5:00 ` Martin Tom Brown 1998-03-02 5:00 ` Kaz Kylheku 2 siblings, 2 replies; 53+ messages in thread From: Terry Moore @ 1998-03-02 5:00 UTC (permalink / raw) In article <6dcdvp$6oa$1@mainsrv.main.nc.us>, scott@softbase.com wrote: > The best refutation of proofs for programs is in Peter van der Linden's > Deep C Secrets. He shows a page from such a proof, which is > incomprehensible to anyone other than a theoretical mathematician, and > then describes a Usenet flame war about an error in a proof. > > There are not enough programmers to go around, and requiring > mathematicians to prove programs on top of them will never work. That is not the way to use proofs of programs. It's much easier to develop the proof along with the program, so it's the programmer's task, not the mathematician's. You might think that proofs add to the time to develop a program, but you must remember that finding and fixing bugs is also very time consuming, and is not guaranteed to be successful. The > only hope we have is "black box" object programming, where an object is > just a plug-in component. It will either work reliably, or can be > replaced if it does not. Who proves the component is correct? As Dijkstra says "Testing can only show the presence of errors, not their absence". -- Terry Moore, Statistics Department, Massey University, New Zealand. Theorems! I need theorems. Give me the theorems and I shall find the proofs easily enough. Bernard Riemann ^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: [++] Tight coding 1998-03-02 5:00 ` Terry Moore @ 1998-03-02 5:00 ` Pete Becker 1998-03-03 5:00 ` Ruud Bruijnesteijn 1998-03-02 5:00 ` Kaz Kylheku 1 sibling, 1 reply; 53+ messages in thread From: Pete Becker @ 1998-03-02 5:00 UTC (permalink / raw) Terry Moore wrote: > > That is not the way to use proofs of programs. It's much easier > to develop the proof along with the program, so it's the > programmer's task, not the mathematician's. > You might think > that proofs add to the time to develop a program, Yes, I do. > but you must > remember that finding and fixing bugs is also very time consuming, > and is not guaranteed to be successful. Which does not change the preceding fact. The issue is not whether these things take time, but how much time they take. In order for this approach to be cost effective you need to show that proving correctness requires less time than fixing defects, which you have not done. -- Pete ^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: [++] Tight coding 1998-03-02 5:00 ` Pete Becker @ 1998-03-03 5:00 ` Ruud Bruijnesteijn 1998-03-03 5:00 ` Pete Becker 0 siblings, 1 reply; 53+ messages in thread From: Ruud Bruijnesteijn @ 1998-03-03 5:00 UTC (permalink / raw) Pete Becker wrote: > > Terry Moore wrote: > > > > That is not the way to use proofs of programs. It's much easier > > to develop the proof along with the program, so it's the > > programmer's task, not the mathematician's. > > Which does not change the preceding fact. The issue is not whether these > things take time, but how much time they take. In order for this > approach to be cost effective you need to show that proving correctness > requires less time than fixing defects, which you have not done. It will be pretty damn difficult to show that in a general case, however a simple look at practical software should suffice ;-). I think there is literature that indicates practical gains of up to 40% in total devellopment time, however. Terry is right, and I'd like to follow up that proving the correctness of a program is quite simple as long as a program is develloped using stepwise refinement and using logical abstractions. I think this is what Terry means when he says 'along with the program'. Split the program into enough modules and procedures for which pre- and postconditions are clear, and you'll end up with trivial proof for these procedures. Now, by way of induction, it will be possible to prove the entire program. You'll need a decent programming language to make this statement valid though! I can tell you in Modula-2 it can be done. Once a program proven this way compiles it will be error-free. It can be done in C too, but there you'll be on your own; the compiler won't help you. I'll admit however, that it is not as simple as that, since there is allways the human factor, creating typo's, errors while copying the algorithms etc. But these errors are quite easily spotted in trivial procedures. So, making a point that proof is (or can be) trivial, you will easily deduct that the actual time it takes to proof is neglectable, certainly when compared to the time wasted on debugging. -- Ruud Bruijnesteijn SDS Sport.Data.Systems GmbH http://www.sds-sportdata.com ^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: [++] Tight coding 1998-03-03 5:00 ` Ruud Bruijnesteijn @ 1998-03-03 5:00 ` Pete Becker 1998-03-04 5:00 ` Terry Moore 0 siblings, 1 reply; 53+ messages in thread From: Pete Becker @ 1998-03-03 5:00 UTC (permalink / raw) Ruud Bruijnesteijn wrote: > > Pete Becker wrote: > > > > Terry Moore wrote: > > > > > > That is not the way to use proofs of programs. It's much easier > > > to develop the proof along with the program, so it's the > > > programmer's task, not the mathematician's. > > > > Which does not change the preceding fact. The issue is not whether these > > things take time, but how much time they take. In order for this > > approach to be cost effective you need to show that proving correctness > > requires less time than fixing defects, which you have not done. > > It will be pretty damn difficult to show that in a general case, Which means that the general statement to which I replied is not provable, which is an even stronger statement than I made. > however > a simple look at practical software should suffice ;-). No, that's the point: looking at what happens with current techniques tells you nothing at all about whether other techniques are better. You have to look at whether the other techniques actually improve things. Mere assertions of faith are not a sound basis for engineering decisions. > I think there is > literature that indicates practical gains of up to 40% in total > devellopment time, however. This assertion of faith is not at all useful. If you have actual data please say so. "I think there is..." means nothing. ^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: [++] Tight coding 1998-03-03 5:00 ` Pete Becker @ 1998-03-04 5:00 ` Terry Moore 1998-03-03 5:00 ` Pete Becker 1998-03-04 5:00 ` Ruud Bruijnesteijn 0 siblings, 2 replies; 53+ messages in thread From: Terry Moore @ 1998-03-04 5:00 UTC (permalink / raw) In article <34FBF347.98CB012B@acm.org>, Pete Becker <petebecker@acm.org> wrote: > Ruud Bruijnesteijn wrote: > > I think there is > > literature that indicates practical gains of up to 40% in total > > devellopment time [if software is developed along with proofs of correcness], however. > > This assertion of faith is not at all useful. If you have actual data > please say so. "I think there is..." means nothing. Conversely, being negative about these ideas without data to back this point of view, is equally meaningless. I take "I think" to mean that he has seen such literature but cannot give a reference off hand. Well, nor can I, but there must be a better way to program than the try-it-and-hope-it-works principle that is used so much now. -- Terry Moore, Statistics Department, Massey University, New Zealand. Theorems! I need theorems. Give me the theorems and I shall find the proofs easily enough. Bernard Riemann ^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: [++] Tight coding 1998-03-04 5:00 ` Terry Moore @ 1998-03-03 5:00 ` Pete Becker 1998-03-04 5:00 ` Ruud Bruijnesteijn 1 sibling, 0 replies; 53+ messages in thread From: Pete Becker @ 1998-03-03 5:00 UTC (permalink / raw) Terry Moore wrote: > > In article <34FBF347.98CB012B@acm.org>, Pete Becker <petebecker@acm.org> wrote: > > > Ruud Bruijnesteijn wrote: > > > > I think there is > > > literature that indicates practical gains of up to 40% in total > > > devellopment time [if software is developed along with proofs > of correcness], however. > > > > This assertion of faith is not at all useful. If you have actual data > > please say so. "I think there is..." means nothing. > > Conversely, being negative about these ideas without data to > back this point of view, is equally meaningless. On the contrary: if you want to persuade me to change the way I do things you must be prepared to demonstrate that I will be better off than before if I make that change. In the absence of data I will not change. That's not negative, it's merely sound engineering. > I take "I think" to mean that he has seen such literature but > cannot give a reference off hand. Well, nor can I, but there > must be a better way to program than the try-it-and-hope-it-works > principle that is used so much now. If you really believe that programmers today mostly resort to "try-it-and-hope-it-works" what possible reason do you have to believe that they are capable of doing proofs of correctness? (I don't share your condescending view of programmers, however). ^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: [++] Tight coding 1998-03-04 5:00 ` Terry Moore 1998-03-03 5:00 ` Pete Becker @ 1998-03-04 5:00 ` Ruud Bruijnesteijn 1 sibling, 0 replies; 53+ messages in thread From: Ruud Bruijnesteijn @ 1998-03-04 5:00 UTC (permalink / raw) Terry Moore wrote: > > In article <34FBF347.98CB012B@acm.org>, Pete Becker <petebecker@acm.org> wrote: > > > Ruud Bruijnesteijn wrote: > > > I think there is > > > > This assertion of faith is not at all useful. If you have actual data > > please say so. "I think there is..." means nothing. > > Conversely, being negative about these ideas without data to > back this point of view, is equally meaningless. > I take "I think" to mean that he has seen such literature but > cannot give a reference off hand. Well, nor can I, but there > must be a better way to program than the try-it-and-hope-it-works > principle that is used so much now. Yes I have seen literature, No I do not have it at hand. So, from my own expierience I can say that: Doing a 190KByte program in Borland C++ (not the worst of devellopment environments I know) took me 3 months. Doing the same program from scratch WITH decent stepwise refinment and on the fly proof for correctness in TopSpeed M2 (Almost as good as Turbo) took me 3 weeks. In fact, it took as much time to type in version A as it did to type version B. However, once that was done, it took me 7 weeks with version A to test (and debug) and 3 days with version B. In fact, after 3 weeks of testing A) we started thinking of throwing the whole damn thing away and start anew. It took further 3 more weeks to finaly take that decision, i.e. as long as it took to redo the entier program! OK, so I AM more fluent in M2 than C++. Still I know at least two other companies in my direct vincinity, that based on lenghty discussions with the software division of my company on programming techniques in general, have adopted a more formal approach to programming, and they have achieved comparable results. One (advanced image recognition) whilst switching from c to pascal, the other (workstation CAD/CAM) decided to stick to C++. However, all three of us have concluded that the number of bugs found at runtime (i.e. when the product is being tested, or even when installed on site with their customers) calculated for more than 60% of the total time for devellopment of the product (i.e. from time of conception of the algorithm to time of delivery) and this can be reduced to approx 10% of total time once proper proving was performed. Yes, there were STILL bugs left, because, as stated earlier, the human factor cannot be ruled out. However, these bugs were mostly due to using mixing up variables or forgetting to properly initialize them. Some compilers would have warned of the latter one, bound-checking catched the others within a couple of minutes. As one of our staff uses to say: Once I find one or two bugs, I can asume it's the odd mistake. Once I've found nr. 10, I can no longer assume that there will be no more, in fact I now know for sure that there will always be one more, and the entier program has to be seriously questioned. -- Ruud Bruijnesteijn SDS Sport.Data.Systems GmbH http://www.sds-sportdata.com ^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: [++] Tight coding 1998-03-02 5:00 ` Terry Moore 1998-03-02 5:00 ` Pete Becker @ 1998-03-02 5:00 ` Kaz Kylheku 1 sibling, 0 replies; 53+ messages in thread From: Kaz Kylheku @ 1998-03-02 5:00 UTC (permalink / raw) In article <T.Moore-0203981541460001@130.123.97.36>, Terry Moore <T.Moore@massey.ac.nz> wrote: >In article <6dcdvp$6oa$1@mainsrv.main.nc.us>, scott@softbase.com wrote: > >> The best refutation of proofs for programs is in Peter van der Linden's >> Deep C Secrets. He shows a page from such a proof, which is >> incomprehensible to anyone other than a theoretical mathematician, and >> then describes a Usenet flame war about an error in a proof. >> >> There are not enough programmers to go around, and requiring >> mathematicians to prove programs on top of them will never work. > >That is not the way to use proofs of programs. It's much easier >to develop the proof along with the program, so it's the >programmer's task, not the mathematician's. You might think >that proofs add to the time to develop a program, but you must >remember that finding and fixing bugs is also very time consuming, >and is not guaranteed to be successful. I sometimes use a technique which is less powerful than a formal verification, but powerful nevertheless. A good program is broken into well defined modules which ``take care'' of some data type. It is of utmost importance that each operation preserve the integrity of the object of this type which was operated on. To enforce this, it's possible to write extended check procedures which can traverse the data structure and verify its integrity, and adherence to its defining properties. For example, in some red-black tree code that I wrote, there is a check procedure which will verify a tree for nearly all of the red-black properties. It will, for instance, determine that each subtree of a node has the same ``black height'' as its sibling. Thus if some operation fails to preserve this property, it will be immediately detected. Or if a red node is found whose children are not both black, again, it is known right away that something went wrong. It is extremely unlikely that some incorrectly written operation would go wrong in such a way that its results will always satisfy an incorrectly written check, because the two are written independently and use different algorithms. Suppose you wrote an algorithm which generates prime numbers, and checked its results with another algorithm which tests whether a number is prime. It is unlikely that you would bugger up both of them in such a way that the checker validates the results produced by the generator, unless you had the wrong notion about what a prime number is in the first place. The penalty is that such checks can raise the running time complexity of your code and contribute to the code size, so may be too impractical to include in a ``production'' version of the code. Another drawback is that you still need high quality test cases in order to exercise the code and provide good coverage. For example, if a particular variant of a data structure never occurs due to the nature of the input data, then a flaw in the construction of that variant will never be discovered. ^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: [++] Tight coding 1998-03-01 5:00 ` scott 1998-03-02 5:00 ` Terry Moore @ 1998-03-02 5:00 ` Martin Tom Brown 1998-03-02 5:00 ` Kaz Kylheku 2 siblings, 0 replies; 53+ messages in thread From: Martin Tom Brown @ 1998-03-02 5:00 UTC (permalink / raw) In article <6dcdvp$6oa$1@mainsrv.main.nc.us> scott@softbase.com writes: > The best refutation of proofs for programs is in Peter van der Linden's > Deep C Secrets. He shows a page from such a proof, which is > incomprehensible to anyone other than a theoretical mathematician, and > then describes a Usenet flame war about an error in a proof. ISTR that the program proofs of the x87 microcode which I think were sponsored by Cyrix revealed several important x87 implementation bugs. Proof of correctness can be useful and *important* sometimes. > There are not enough programmers to go around, and requiring > mathematicians to prove programs on top of them will never work. In fact the best scope for having reusable components is if they come with a proof or certificate of fitness for purpose. The trend unfortunately is toward the shrink wrap disclaimer :( > only hope we have is "black box" object programming, where an object is > just a plug-in component. It will either work reliably, or can be > replaced if it does not. To define "work reliably" you have to specify what it does, over what domains of input, and what happens with out of domain data. Enumerating all cases is impossible so you are back to some sort of formal method to manipulate expressions in general terms. Ariane 5 is a salutory warning about what happens when you reuse code without properly analysing the differences in specification. Regards, -- Martin Brown <martin@nezumi.demon.co.uk> __ CIS: 71651,470 Scientific Software Consultancy /^,,)__/ ^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: [++] Tight coding 1998-03-01 5:00 ` scott 1998-03-02 5:00 ` Terry Moore 1998-03-02 5:00 ` Martin Tom Brown @ 1998-03-02 5:00 ` Kaz Kylheku 2 siblings, 0 replies; 53+ messages in thread From: Kaz Kylheku @ 1998-03-02 5:00 UTC (permalink / raw) In article <6dcdvp$6oa$1@mainsrv.main.nc.us>, <scott@softbase.com> wrote: >The best refutation of proofs for programs is in Peter van der Linden's >Deep C Secrets. He shows a page from such a proof, which is >incomprehensible to anyone other than a theoretical mathematician, and >then describes a Usenet flame war about an error in a proof. > >There are not enough programmers to go around, and requiring >mathematicians to prove programs on top of them will never work. The >only hope we have is "black box" object programming, where an object is >just a plug-in component. It will either work reliably, or can be >replaced if it does not. But over time, you could create libraries of formally proven black boxes. The time required to do the proof is worthwhile if countless people can benefit from it. I don't believe your claim that such proofs are comprehensible only to theoretical mathematitican. Anyone with a background in computer science should be able to follow such a proof. The proofs usually involve simple predicate logic, and simple algebra. There exist excellent textbooks on formal verification which can provide a refresher course. Knowing the techniques can help you write more solid code even in situations where you don't apply the techniques, because they give you a framework for reasoning about program logic. ^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: [++] Tight coding 1998-03-01 5:00 ` [++] Tight coding Bill Moyer 1998-03-01 5:00 ` Ruud Bruijnesteijn @ 1998-03-01 5:00 ` Larry Kilgallen 1998-03-01 5:00 ` [++] Tight coding (comp.sys.dec-only thread) Bill Moyer 1998-03-02 5:00 ` [++] Tight coding Peter Moylan 2 siblings, 1 reply; 53+ messages in thread From: Larry Kilgallen @ 1998-03-01 5:00 UTC (permalink / raw) In article <6dbgjv$lg$1@andros.cygnus.com>, billm@cygnus.com (Bill Moyer) writes: > I think that techniques discarded in the past for being slow, > inconvenient, or impractical (memory segmentation with bounds > checking, strong type checking, compile-time proving of code > correctness, et al) might be worth another look. Run-time > bounds checking increases the processor power required to run > applications, but applications which are bottlenecked by crash > frequency (eg, programmer error in pointer arithmetic) would > benefit from it. You may not have noticed the massive cross-posting, but this thread goes to comp.sys.dec where at least some of us now use strong type checking and avoid pointer arithmetic... > Changing the programming language to improve compile-time > verification of code correctness (with richer and stronger > types, richer static semantic sets, and compile-time range > tracking) would locate more bugs at compile-time, reduce the > number of bugs in a "finished" product, and reduce the overall > time spent in the development cycle (because finding run-time > bugs is a much longer and more laborious task than finding > them at compile-time). It has been proven that the imperative > languages are not provable (ie, for any turing-complete imper- > ative language, a program can be written which is not provably > correct or incorrect), but it is still possible to improve > provability by degrees, and we can do a lot better than C. ...not everyone reading your post uses C. Larry Kilgallen ^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: [++] Tight coding (comp.sys.dec-only thread) 1998-03-01 5:00 ` Larry Kilgallen @ 1998-03-01 5:00 ` Bill Moyer 0 siblings, 0 replies; 53+ messages in thread From: Bill Moyer @ 1998-03-01 5:00 UTC (permalink / raw) In article <1998Mar1.144246.1@eisner> Kilgallen@eisner.decus.org.nospam writes: > >You may not have noticed the massive cross-posting, but this >thread goes to comp.sys.dec where at least some of us now use >strong type checking and avoid pointer arithmetic... I know; I was the one who removed some of the newsgroups (ie, comp.sys.intel and comp.arch) and added others (c++, modula3). I kept comp.sys.dec for entirely selfish reasons; it is the only one of the set that I read every day, and I felt justified because the thread originated here. If it is too inappropriate a topic for this newsgroup, I apologize. I will remove it and try to hit comp.lang.modula3 daily. >thread goes to comp.sys.dec where at least some of us now use >strong type checking and avoid pointer arithmetic... >...not everyone reading your post uses C. I know, and I would appreciate your input on this topic. Those of us who use multiple languages (and use them to good advantage) are at least aware of how language semantics can influence code quality. If I talked about this only with C programmers, I would get little in the way of intelligent conversation or respect (a lesson I learned the hard way). -- Bill Moyer ^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: [++] Tight coding 1998-03-01 5:00 ` [++] Tight coding Bill Moyer 1998-03-01 5:00 ` Ruud Bruijnesteijn 1998-03-01 5:00 ` Larry Kilgallen @ 1998-03-02 5:00 ` Peter Moylan 1998-03-02 5:00 ` Martin Harvey ` (4 more replies) 2 siblings, 5 replies; 53+ messages in thread From: Peter Moylan @ 1998-03-02 5:00 UTC (permalink / raw) Bill Moyer <billm@cygnus.com> wrote: > There have already been some halfhearted attempts to solve >the problems of increasing program complexity by application >of object-oriented techniques, but the more I see the object >oriented style fail to live up to its promises, [...] I'm constantly amazed at the way the OO paradigm has taken over so many minds. In my experience it's great for toy programs, but gives you a complexity blow-out on any reasonable-sized project. Admittedly a lot of my OO experience comes in conjunction with using the Microsoft Foundation Class library, which seems to have been designed expressly for the purpose of convincing people that OO libraries are evil. Nevertheless, I am still not convinced that there's a good way to use OO techniques in conjunction with clean programming practices. > [...] Use of memory segmentation would help pin- >point which data structure (or catagory of data structures) >was corrupted, and allow recovery routines to perhaps repair >the damage and continue with application execution; this >would be a big improvement over "Segmentation Fault; core >dumped" or "GPF 314159". One of my major gripes about C is the strong influence it's had on operating systems design. We have memory segmentation. We've had it for years. What we don't have are operating systems that make proper use of the segmentation hardware. It's true that the earliest attempts to introduce segmentation were killed off by considerations of hardware cost and speed. But those problems were solved some years ago, when the 80286 first appeared. Once you can get the segmentation hardware onto the processor chip, and have some space left over for decent-sized caches, you've got the technology to bring segmentation to the masses at an affordable cost. The catch is that you have all those C programmers demanding a "linear address space". Why would anyone need a linear address space? Answer: it's needed if you want to do dirty tricks with pointer arithmetic. Never mind that those dirty tricks fell out of favour years ago. The C standard says that they're legal, so any C compiler that doesn't support them is not standard-compliant. For the more modern programming languages, a segmented address space is superior. There's a natural mapping between module boundaries and segment boundaries. Unfortunately, our compilers tend not to take advantage of this, because of the bias in the operating systems support towards linear addressing. Indeed, the segmentation hardware is not taking off the way one would have expected. Even Intel, which must have invested a fortune in developing their segmentation hardware, has dropped the idea. They keep it in their 80x86 line for backwards compatibility, but they're not putting segmentation hardware into their other processors. Presumably they decided that the demand just wasn't there. > [...] and we can do a lot better than C. Perhaps you hadn't noticed the newsgroups to which this was cross-posted. Most of us are already doing a lot better than C. -- Peter Moylan peter@ee.newcastle.edu.au http://www.ee.newcastle.edu.au/users/staff/peter/Moylan.html OS/2 tuning tips at http://www.ee.newcastle.edu.au/users/staff/peter/os2/tuning.html ^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: [++] Tight coding 1998-03-02 5:00 ` [++] Tight coding Peter Moylan @ 1998-03-02 5:00 ` Martin Harvey 1998-03-02 5:00 ` Scott Fluhrer ` (3 subsequent siblings) 4 siblings, 0 replies; 53+ messages in thread From: Martin Harvey @ 1998-03-02 5:00 UTC (permalink / raw) Verily, peter@eepjm.newcastle.edu.au (Peter Moylan) spake thus: >I'm constantly amazed at the way the OO paradigm has taken >over so many minds. In my experience it's great for toy >programs, but gives you a complexity blow-out on any >reasonable-sized project. Admittedly a lot of my OO experience >comes in conjunction with using the Microsoft Foundation >Class library, which seems to have been designed expressly >for the purpose of convincing people that OO libraries are >evil. Nevertheless, I am still not convinced that there's >a good way to use OO techniques in conjunction with clean >programming practices. Peter, While you post plenty of excellent advice... I am slightly inclined to disagree here....! I find that OO libraries, when well written, can be great for reducing complexity. However... the reason that they introduce additional complexity is because of the subtleties involved in inheritance and polymorphism. They seem like fairly simple concepts, but when applied on a large scale, they can do very odd things. I think the secret to OO programming is to think everything through well in advance. From my experience, OO architectures can be great for data hiding and abstraction, but they really don't like ad-hoc solutions or modification. You can do lots of really subtle and neat things (especially when using "advanced" OO techniques, such as metaclasses, polymorphic construction etc etc....) and some of these techniques are very powerful, but one has to design elegantly. Alas... to many C++ programmers from a C background..... <g> To be honest, having recently gone back to M-2 (for a few weeks) having used Delphi, I was amazed at how simple everything was. I have to confess that I found OO and event driven programming so neat, then when writing my Modula-2, I ended up using opaque and abstract data types loads, and started writing code with loads of callbacks in, to make my M-2 stuff "event driven (see IRC via DOS post!). I suspect that OO programming is very powerful... but can be badly misused. I've just written about 15,000 lines of Delphi communications code, all of which is message based and asynchronous. I wouldn't have been able to write it at all in a non OO paradigm (involving as it does implementing distributed OO protocols), and it is an order of magnitue more powerful than anything I could have written in M-2 or C given the same limit on code size. However, it's just too easy to get things wrong if you start using OO code that you 1) Didn't write, 2) don't fully understand, or 3) is poorly documented, because OO introduces subtlety in everything you do ... eg. MyObject.DoFoo(SomeObject:TObject); A simple method call to an object, supplying another object. Simple right? Wrong. 1. The method may be virtual... and thus call various other methods. 2. The parameter may be of any object type descended from TObject, this call may call some of "SomeObjects" methods, which may in turn be virtual, and call other methods back in the original MyObject.... which may be virtual & overriden etc etc. I've seen simple method calls like this do the most wierd and wonderful things ... anyway... I've run out of energy for today ... so that's my $.02. MH. ^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: [++] Tight coding 1998-03-02 5:00 ` [++] Tight coding Peter Moylan 1998-03-02 5:00 ` Martin Harvey @ 1998-03-02 5:00 ` Scott Fluhrer 1998-03-02 5:00 ` Kaz Kylheku ` (2 subsequent siblings) 4 siblings, 0 replies; 53+ messages in thread From: Scott Fluhrer @ 1998-03-02 5:00 UTC (permalink / raw) In <slrn6fk0pe.5t2.peter@eepjm.newcastle.edu.au> peter@eepjm.newcastle.edu.au (Peter Moylan) writes: > > >One of my major gripes about C is the strong influence it's >had on operating systems design. > >We have memory segmentation. We've had it for years. What >we don't have are operating systems that make proper use >of the segmentation hardware. You mean Windows 3.1 and OS/2 version 1.x don't count? > >It's true that the earliest attempts to introduce segmentation >were killed off by considerations of hardware cost and speed. >But those problems were solved some years ago, when the >80286 first appeared. Huh??? Have you actually tried writing a heavily segmented program for the 80286? The program is *much* larger and slower that a flat model program. That's the reason there was much rejoicing when the 386 came out, and you could make a decent sized program without worrying about the %^&$#^&*%@ segment/selector registers The reasons why segementation on the 80x86 series is so lousy: - You had a total of 2 segment registers you could use to access data not on the stack (with the 386 and later, you got 4). This makes it difficult for compilers to access multiple objects at once (and, to access data in a segment, you have to stuff it in one of your two precious segment registers) - When you reload a segment register in protected mode, the processor would pause for an amazingly long time while it reloaded the contents of the LDT/GDT. Also, on the 286 (and the 386 and beyond), you were limited to a total of 16382 segments at any one time (this includes any segments needed by the OS, interrupt handlers, everything). If you tried to segment everything, a large program would easily hit this limit. > Once you can get the segmentation >hardware onto the processor chip, and have some space left over >for decent-sized caches, you've got the technology to bring >segmentation to the masses at an affordable cost. > >The catch is that you have all those C programmers demanding >a "linear address space". Why would anyone need a linear >address space? Answer: it's needed if you want to do dirty >tricks with pointer arithmetic. Never mind that those dirty >tricks fell out of favour years ago. The C standard says >that they're legal, so any C compiler that doesn't support >them is not standard-compliant. Please state where in the C standard where any pointer arithmetic is legal, except within a single array (which would be in a single segment anyways). > >For the more modern programming languages, a segmented >address space is superior. There's a natural mapping between >module boundaries and segment boundaries. Unfortunately, >our compilers tend not to take advantage of this, because of >the bias in the operating systems support towards linear >addressing. Or rather, the total lack of any modern architecture with any sort of adequate segment support -- that is, have a reasonable large maximum on the total number of segments, and not have a huge performance hit when you use them > >Indeed, the segmentation hardware is not taking off the way >one would have expected. Even Intel, which must have invested >a fortune in developing their segmentation hardware, has >dropped the idea. They keep it in their 80x86 line for >backwards compatibility, but they're not putting segmentation >hardware into their other processors. Presumably they >decided that the demand just wasn't there. Or, maybe, they actually *studied* the idea, and came to the conclusing that it was a bad one... -- poncho ^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: [++] Tight coding 1998-03-02 5:00 ` [++] Tight coding Peter Moylan 1998-03-02 5:00 ` Martin Harvey 1998-03-02 5:00 ` Scott Fluhrer @ 1998-03-02 5:00 ` Kaz Kylheku 1998-03-02 5:00 ` Lawrence Kirby 1998-03-03 5:00 ` Larry Kilgallen 4 siblings, 0 replies; 53+ messages in thread From: Kaz Kylheku @ 1998-03-02 5:00 UTC (permalink / raw) In article <slrn6fk0pe.5t2.peter@eepjm.newcastle.edu.au>, Peter Moylan <peter@ee.newcastle.edu.au> wrote: >One of my major gripes about C is the strong influence it's >had on operating systems design. > >We have memory segmentation. We've had it for years. What >we don't have are operating systems that make proper use >of the segmentation hardware. > >It's true that the earliest attempts to introduce segmentation >were killed off by considerations of hardware cost and speed. >But those problems were solved some years ago, when the >80286 first appeared. Once you can get the segmentation >hardware onto the processor chip, and have some space left over >for decent-sized caches, you've got the technology to bring >segmentation to the masses at an affordable cost. > >The catch is that you have all those C programmers demanding >a "linear address space". Why would anyone need a linear >address space? Answer: it's needed if you want to do dirty >tricks with pointer arithmetic. Never mind that those dirty >tricks fell out of favour years ago. The C standard says >that they're legal, so any C compiler that doesn't support >them is not standard-compliant. That is false. The C standard says no such thing; but of course, to know that you actually have to read it, hint hint. If you compare two pointers to distinct objects for anything other than exact equality, the behavior is undefined. Furthermore, if you use pointer arithmetic to produce a pointer that would point outside of the boundaries of the object it was derived from, the behavior is undefined. The only exception is that a pointer one element past the end of an array may be safely produced. The reason operating system designers tend to eschew segmentation is that it would make the operating system too dependent on one particular hardware (or at least its central memory-management core). Not all processors support the concept of segmentation in their memory management infrastructure. When Linux was ported away from the x86 architecture, one of its aspects that had to be abstracted was its use of segmentation. And Linux only uses segmentation in an extremely basic way; the user data is in a separate segment whose selector is loaded into the 'FS' segment register, so that copying memory from user space to kernel space and vice versa involves two segments. Luckily, Linux used fairly abstract functions to do this, even though the 'FS' crept into their nomenclature. Nevertheless, even this basic use of segmentation hardware created portability considerations. Fuill blown segmentation use could be a nightmare. ^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: [++] Tight coding 1998-03-02 5:00 ` [++] Tight coding Peter Moylan ` (2 preceding siblings ...) 1998-03-02 5:00 ` Kaz Kylheku @ 1998-03-02 5:00 ` Lawrence Kirby 1998-03-02 5:00 ` Peter Moylan 1998-03-03 5:00 ` Larry Kilgallen 4 siblings, 1 reply; 53+ messages in thread From: Lawrence Kirby @ 1998-03-02 5:00 UTC (permalink / raw) In article <slrn6fk0pe.5t2.peter@eepjm.newcastle.edu.au> peter@ee.newcastle.edu.au "Peter Moylan" writes: ... >One of my major gripes about C is the strong influence it's >had on operating systems design. > >We have memory segmentation. We've had it for years. What >we don't have are operating systems that make proper use >of the segmentation hardware. > >It's true that the earliest attempts to introduce segmentation >were killed off by considerations of hardware cost and speed. >But those problems were solved some years ago, when the >80286 first appeared. The 8086 and 80286 employ segmentation as a hack to increase memory address space. It is totally inadequate as a vehicle for providing the benefits of a true segmented archetecture. > Once you can get the segmentation >hardware onto the processor chip, and have some space left over >for decent-sized caches, you've got the technology to bring >segmentation to the masses at an affordable cost. Perhaps, but it is the x86 archetecture that has given segmentation a bad name, not any specific programming language. >The catch is that you have all those C programmers demanding >a "linear address space". Why would anyone need a linear >address space? Answer: it's needed if you want to do dirty >tricks with pointer arithmetic. Never mind that those dirty >tricks fell out of favour years ago. The C standard says >that they're legal, so any C compiler that doesn't support >them is not standard-compliant. ANSI C is designed to work in a segmented archetecture, it in no way requires a linear address space. It is invalid in ANSI C to perform pointer arithmetic beyond the bounds of the current object (except a one-past-the-end-rule which isn't a major issue). == and != can be used to compare pointers into different objects but not > >= < or <=. Every variable you define and every object you allocate with malloc/calloc/realloc could be placed in a different segment and that would be a valid ANSI C implementation. The standard was quite carefully crafted to make an efficient implemenattion of the language possible on a segmented archetecture. >For the more modern programming languages, a segmented >address space is superior. There's a natural mapping between >module boundaries and segment boundaries. Unfortunately, >our compilers tend not to take advantage of this, because of >the bias in the operating systems support towards linear >addressing. Maybe because that makes best use of the available hardware. Maybe Unix has some relevance here being the mainstream OS that is "portable" across hardware platforms. >Indeed, the segmentation hardware is not taking off the way >one would have expected. Even Intel, which must have invested >a fortune in developing their segmentation hardware, has >dropped the idea. They keep it in their 80x86 line for >backwards compatibility, but they're not putting segmentation >hardware into their other processors. Presumably they >decided that the demand just wasn't there. More likely the x86 implementation killed any demand that there might have been. >> [...] and we can do a lot better than C. > >Perhaps you hadn't noticed the newsgroups to which this was >cross-posted. Most of us are already doing a lot better >than C. You don't appear to know C well enough to make that judgement. -- ----------------------------------------- Lawrence Kirby | fred@genesis.demon.co.uk Wilts, England | 70734.126@compuserve.com ----------------------------------------- ^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: [++] Tight coding 1998-03-02 5:00 ` Lawrence Kirby @ 1998-03-02 5:00 ` Peter Moylan 1998-03-02 5:00 ` Ketil Z Malde ` (2 more replies) 0 siblings, 3 replies; 53+ messages in thread From: Peter Moylan @ 1998-03-02 5:00 UTC (permalink / raw) Lawrence Kirby <fred@genesis.demon.co.uk> wrote: >In article <slrn6fk0pe.5t2.peter@eepjm.newcastle.edu.au> > peter@ee.newcastle.edu.au "Peter Moylan" writes: > >... > >>One of my major gripes about C is the strong influence it's >>had on operating systems design. >> >>We have memory segmentation. We've had it for years. What >>we don't have are operating systems that make proper use >>of the segmentation hardware. >> >>It's true that the earliest attempts to introduce segmentation >>were killed off by considerations of hardware cost and speed. >>But those problems were solved some years ago, when the >>80286 first appeared. > >The 8086 and 80286 employ segmentation as a hack to increase memory >address space. It is totally inadequate as a vehicle for providing the >benefits of a true segmented archetecture. You're mixing two things here. The 8086, it is true, did not have hardware segmentation. The 80286 did. It had some shortcomings - e.g. the limit on segment size - but this was still better than no segmentation at all. Some of the shortcomings were removed in the 80386. > >> Once you can get the segmentation >>hardware onto the processor chip, and have some space left over >>for decent-sized caches, you've got the technology to bring >>segmentation to the masses at an affordable cost. > >Perhaps, but it is the x86 archetecture that has given segmentation a bad >name, not any specific programming language. Specifically the 8086. Yes, I agree. Intel tried to say that the 8086 had a segmented address space; the programmers discovered that it didn't; and then companies like Microsoft simply ignored the segmentation hardware of the 80286 and treated it as a pseudo-8086. Subsequently operating systems like OS/2, Windows NT, and Linux used a small subset of the segmentation possibilities, just enough to get a large address space without going all the way towards using true segmentation. What's worse, the majority of 80x86 users are still running DOS shells like Win95, which treat the segmentation hardware like an add-on kludge. The hardware supports true segmentation, the system programmers don't. >>The catch is that you have all those C programmers demanding >>a "linear address space". [...] > >ANSI C is designed to work in a segmented archetecture, it in no way >requires a linear address space. It is invalid in ANSI C to perform >pointer arithmetic beyond the bounds of the current object (except a >one-past-the-end-rule which isn't a major issue). == and != can be used >to compare pointers into different objects but not > >= < or <=. Every >variable you define and every object you allocate with malloc/calloc/realloc >could be placed in a different segment and that would be a valid ANSI C >implementation. The standard was quite carefully crafted to make an >efficient implemenattion of the language possible on a segmented >archetecture. OK, I expressed myself badly. True, the standard says that you shouldn't perform dirty tricks on pointers. But the standard does _not_ say that compilers should check for violations, or even that compilers should issues warnings about doing something stupid. So in practice the compilers accept questionable pointer arithmetic, and most C compilers have things like bounds checking disabled by default. They have to, for at least two reasons. First, that sort of checking is very expensive in a language like C. (The language rules mean that very little checking can be done at compile time; they also make it very difficult to detect pointers that run outside their bounds.) Second, and perhaps more important, thousands of programmers and project managers would scream blue bloody murder if a compiler/runtime system enforced those rules, because it would break 90% of their existing software. The rules in the C standard are a token effort at saying "don't make mistakes, or I'll call you a naughty boy and make you stand in the corner". There is absolutely no enforcement built in. In fact, the rules about bounds violations are simply a disclaimer to protect compiler developers, so they can say "yes, I know the compiler failed to warn you of this error, but it's not our fault; the warranty doesn't cover the sort of software you're writing". >>Perhaps you hadn't noticed the newsgroups to which this was >>cross-posted. Most of us are already doing a lot better >>than C. > >You don't appear to know C well enough to make that judgement. You're probably right, people have been telling me that for the last 25 years. But the software I produce - using C among other languages - works, and it's delivered on time and within budget. (Not many developers can make that claim.) So I think I'm entitled to an opinion. Furthermore, I have continued to resist the modern practice of charging an "upgrade" price for bug fixes that are delivered a year late. Just recently, a builder came to my house and repaired an error made by one of his carpenters. He didn't charge me, because the error was his responsibility. In practically every industry, fixing the bugs is part of the original contract price. If the same idea was accepted in the software industry, the use of bug-prone programming languages would disappear overnight. I'm going to be flamed for saying this, but I'll say it anyway. The C programming language was good for its time, but it became obsolete somewhere in the 1970s. There are just two reasons why C remains in widespread use today. First, the incredible but growing conservativeness of today's CS instructors who work so hard at protecting their discipline from the heresy of innovation. Second, the fact that it's still possible to make a profit delivering buggy products. -- Peter Moylan peter@ee.newcastle.edu.au ^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: [++] Tight coding 1998-03-02 5:00 ` Peter Moylan @ 1998-03-02 5:00 ` Ketil Z Malde 1998-03-04 5:00 ` Lyn A Headley 1998-03-02 5:00 ` Kaz Kylheku 1998-03-03 5:00 ` Lawrence Kirby 2 siblings, 1 reply; 53+ messages in thread From: Ketil Z Malde @ 1998-03-02 5:00 UTC (permalink / raw) peter@PJM2.newcastle.edu.au (Peter Moylan) writes: > You're probably right, people have been telling me that for the > last 25 years. But the software I produce - using C among other > languages - works, and it's delivered on time and within budget. > (Not many developers can make that claim.) So I think I'm > entitled to an opinion. Neat handling of a rather condescending remark. Impressive. What are you, an *adult* or something? > I'm going to be flamed for saying this, but I'll say it anyway. [click-click] > The C programming language was good for its time, but it became > obsolete somewhere in the 1970s. There are just two reasons why > C remains in widespread use today. First, the incredible but > growing conservativeness of today's CS instructors who work > so hard at protecting their discipline from the heresy of innovation. I won't say you're blatantly wrong, but IMHE, I find that CS instructors are pretty open to new innovations, and some spend quite a bit of effort inventing them. Where I went to college, they don't even *teach* C as part of any course I'm aware of. Students do use it, of course, e.g. for building compilers. The openness of instructors might of course vary from institution to institution. I think the inertia is also due to the C inheritance inherent in Unix and MS's OSes, which are the main development platforms of this day, and the vast number of tools, components, and of course, sample code widely distributed. > Second, the fact that it's still possible to make a profit delivering > buggy products. No dispute. ~kzm -- If I haven't seen further, it is by standing in the footprints of giants ^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: [++] Tight coding 1998-03-02 5:00 ` Ketil Z Malde @ 1998-03-04 5:00 ` Lyn A Headley 0 siblings, 0 replies; 53+ messages in thread From: Lyn A Headley @ 1998-03-04 5:00 UTC (permalink / raw) >>>>> "Ketil" == Ketil Z Malde <ketil@ii.uib.no> writes: Ketil> spend quite a bit of effort inventing them. Where I went Ketil> to college, they don't even *teach* C as part of any course Ketil> I'm aware of. Students do use it, of course, e.g. for Ketil> building compilers. *shudder*. What a horrid thought. -- Lyn Headley remove the word "bogus" from my address for the real one. ^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: [++] Tight coding 1998-03-02 5:00 ` Peter Moylan 1998-03-02 5:00 ` Ketil Z Malde @ 1998-03-02 5:00 ` Kaz Kylheku 1998-03-03 5:00 ` Lawrence Kirby 2 siblings, 0 replies; 53+ messages in thread From: Kaz Kylheku @ 1998-03-02 5:00 UTC (permalink / raw) In article <6de8o0$kau$1@seagoon.newcastle.edu.au>, Peter Moylan <peter@ee.newcastle.edu.au> wrote: >OK, I expressed myself badly. True, the standard says that you shouldn't >perform dirty tricks on pointers. But the standard does _not_ say that >compilers should check for violations, or even that compilers should >issues warnings about doing something stupid. So in practice the >compilers accept questionable pointer arithmetic, and most C compilers >have things like bounds checking disabled by default. They have to, >for at least two reasons. First, that sort of checking is very expensive in >a language like C. (The language rules mean that very little checking >can be done at compile time; they also make it very difficult to detect >pointers that run outside their bounds.) Actually, the extent of the success of the bounds checking GCC project would tend to indicate that such checking is feasible. It is surprising how simple it is and the extent to which it can pin-point errors, and it does this without changing the representation of pointers. The run time hit isn't all that bad either (but you still wouldn't want it in production code, needless to say). It's acceptable for ``smoke testing''. Second, and perhaps more >important, thousands of programmers and project managers would >scream blue bloody murder if a compiler/runtime system enforced those >rules, because it would break 90% of their existing software. That may be true, but how do we now leap to the conclusion that C has influenced operating system design toward ignoring segmentation hardware? That is really the only assertion made in this discussion thread that is worthy of controversy. I think that most programmers and managers would have a positive response to a tool that would catch deep errors. We can't let Dilbert comics completely determine our view of managers and developers. >The rules in the C standard are a token effort at saying "don't make >mistakes, or I'll call you a naughty boy and make you stand in the corner". No, the rules in the C standard exist to enable certain kinds of implementations. Because one may not compares pointers to distinct objects for anything other than exact equality, compilers may be constructed which place objects in separate logical memory segments. Requiring diagnostic capability for a violation of this rule, on the other hand, might place a severe burden on some implementors---at least according to the best collective wisdom of the standard writers. If the C standard allow arbitrary pointers to be compared in arbitrary ways, with well-defined results, such implementations would have difficulty meeting its requirements. >There is absolutely no enforcement built in. In fact, the rules about >bounds violations are simply a disclaimer to protect compiler >developers, so they can say "yes, I know the compiler failed to warn >you of this error, but it's not our fault; the warranty doesn't cover the >sort of software you're writing". It's not an uncommon opinion that undefined behaviors in the language standards are there in order to absolve the compiler implementors of blame for software failure. However, I believe that it is an unrealistically cynical opinion. The real reasons are that by leaving certain aspects of the language undefined, implementors have more choices as to how something should be implemented. Also, we have to remember that the C language was in widespread use before it was standardized, for better or worse. Sometimes the most ridiculous and easily diagnosable aspects are undefined. For example, if, in a string or character literal, a backslash is followed by something that isn't a valid escape sequence, the behavior is undefined. It's obvious that this is trivial to diagnose, but there is probably a good reason why a diagnostic is not required. The C language has had only one standard approved by ISO so far, and is nearing the completion of a second. As time goes on, we can expect at least some parts of the language to ``tighten up''. But the first standard had to be workable in the way of reflecting existing practice. >>>Perhaps you hadn't noticed the newsgroups to which this was >>>cross-posted. Most of us are already doing a lot better >>>than C. >> >>You don't appear to know C well enough to make that judgement. > >You're probably right, people have been telling me that for the >last 25 years. But the software I produce - using C among other >languages - works, and it's delivered on time and within budget. >(Not many developers can make that claim.) So I think I'm >entitled to an opinion. > >Furthermore, I have continued to resist the modern practice of >charging an "upgrade" price for bug fixes that are delivered a >year late. That's hard to do if the bug fixes are not well separated from genuine enhancements that were also done to the software. There is a difference between a genuine upgrade and strictly bug-fix patches done to the older release. If the software you are getting includes many enhancements that you want as well as bug fixes, what are you paying for? In one sense, you are paying for everything the developer does; including support, marketing, sales. Should you also object that part of the price you pay goes to paying the developer's receptionist, and marketing staff, or office rent? I believe in free bug fix patches; it's hard to disagree with such a policy, because it is based on well-founded ethical principles. The developer should put in as many bug fixes into the older version of the software as possible and make that available to the end user as an alternative to the upgrade option, but it's almost inevitable taht some problems will only be resolved in an upgrade. Sometimes only a design change can resolve some problems, or the bug fix came about as a result of a complete rewrite of some subsystem which can't be retrofitted into the old version for whatever reasons. >Just recently, a builder came to my house and repaired an error >made by one of his carpenters. He didn't charge me, because >the error was his responsibility. In practically every industry, fixing >the bugs is part of the original contract price. If the same idea was >accepted in the software industry, the use of bug-prone programming >languages would disappear overnight. If things are so rosy outside of the software industry, why do there exist ``home owner protection'' type insurance schemes? ;) ^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: [++] Tight coding 1998-03-02 5:00 ` Peter Moylan 1998-03-02 5:00 ` Ketil Z Malde 1998-03-02 5:00 ` Kaz Kylheku @ 1998-03-03 5:00 ` Lawrence Kirby 2 siblings, 0 replies; 53+ messages in thread From: Lawrence Kirby @ 1998-03-03 5:00 UTC (permalink / raw) In article <6de8o0$kau$1@seagoon.newcastle.edu.au> peter@ee.newcastle.edu.au "Peter Moylan" writes: >Lawrence Kirby <fred@genesis.demon.co.uk> wrote: >>In article <slrn6fk0pe.5t2.peter@eepjm.newcastle.edu.au> >> peter@ee.newcastle.edu.au "Peter Moylan" writes: >> >>... >> >>>One of my major gripes about C is the strong influence it's >>>had on operating systems design. >>> >>>We have memory segmentation. We've had it for years. What >>>we don't have are operating systems that make proper use >>>of the segmentation hardware. >>> >>>It's true that the earliest attempts to introduce segmentation >>>were killed off by considerations of hardware cost and speed. >>>But those problems were solved some years ago, when the >>>80286 first appeared. >> >>The 8086 and 80286 employ segmentation as a hack to increase memory >>address space. It is totally inadequate as a vehicle for providing the >>benefits of a true segmented archetecture. > >You're mixing two things here. The 8086, it is true, did not have hardware >segmentation. The 80286 did. It had some shortcomings - e.g. the >limit on segment size - but this was still better than no segmentation at >all. Some of the shortcomings were removed in the 80386. I'm not convinced that even with a 386 you could create a usable finely segmented environment. ... >>> Once you can get the segmentation >>>hardware onto the processor chip, and have some space left over >>>for decent-sized caches, you've got the technology to bring >>>segmentation to the masses at an affordable cost. >> >>Perhaps, but it is the x86 archetecture that has given segmentation a bad >>name, not any specific programming language. > >Specifically the 8086. Yes, I agree. Intel tried to say that the 8086 had >a segmented address space; the programmers discovered that it >didn't; and then companies like Microsoft simply ignored the segmentation >hardware of the 80286 and treated it as a pseudo-8086. Subsequently >operating systems like OS/2, Windows NT, and Linux used a small >subset of the segmentation possibilities, just enough to get a large >address space without going all the way towards using true segmentation. >What's worse, the majority of 80x86 users are still running DOS shells >like Win95, which treat the segmentation hardware like an add-on kludge. >The hardware supports true segmentation, the system programmers don't. How you you like to see it used? ... >OK, I expressed myself badly. True, the standard says that you shouldn't >perform dirty tricks on pointers. But the standard does _not_ say that >compilers should check for violations, or even that compilers should >issues warnings about doing something stupid. So in practice the >compilers accept questionable pointer arithmetic, and most C compilers >have things like bounds checking disabled by default. They have to, >for at least two reasons. First, that sort of checking is very expensive in >a language like C. (The language rules mean that very little checking >can be done at compile time; they also make it very difficult to detect >pointers that run outside their bounds.) That's an argument for using C with a segmented environment so that these checks can be performed efficiently at runtime. > Second, and perhaps more >important, thousands of programmers and project managers would >scream blue bloody murder if a compiler/runtime system enforced those >rules, because it would break 90% of their existing software. Such software that it would break wouldn't be very portable anyway. What sort of common practices require the use of out of bounds pointers? >The rules in the C standard are a token effort at saying "don't make >mistakes, or I'll call you a naughty boy and make you stand in the corner". >There is absolutely no enforcement built in. In fact, the rules about >bounds violations are simply a disclaimer to protect compiler >developers, so they can say "yes, I know the compiler failed to warn >you of this error, but it's not our fault; the warranty doesn't cover the >sort of software you're writing". The rules about bounds violations are specifically to allow C to be implemented in non-linear environments. Going out of bounds with pointers usually is an error (i.e. something that the programmer didn't intend). I don't think the problem is as big as you're suggesting. Non-portable assumptions about datatype sizes and alignment tend to be a bigger issue. >>>Perhaps you hadn't noticed the newsgroups to which this was >>>cross-posted. Most of us are already doing a lot better >>>than C. >> >>You don't appear to know C well enough to make that judgement. > >You're probably right, people have been telling me that for the >last 25 years. But the software I produce - using C among other >languages - works, and it's delivered on time and within budget. >(Not many developers can make that claim.) So I think I'm >entitled to an opinion. Sure, but we were discussing the compatibility between C and segmented environments, not code quality. Good code will run whether the environment is segmented or not. >Furthermore, I have continued to resist the modern practice of >charging an "upgrade" price for bug fixes that are delivered a >year late. I've no reason to doubt your competence and professionalism as a software developer. You were however making some incorrect assertions about C and appeared to be making value judgements based on those. >Just recently, a builder came to my house and repaired an error >made by one of his carpenters. He didn't charge me, because >the error was his responsibility. In practically every industry, fixing >the bugs is part of the original contract price. If the same idea was >accepted in the software industry, the use of bug-prone programming >languages would disappear overnight. Right, but that is a different topic entirely to what we were discussing. >I'm going to be flamed for saying this, but I'll say it anyway. The >C programming language was good for its time, but it became >obsolete somewhere in the 1970s. It takes a little more discipline to write error-free software in C but it really isn't that hard. The language has progressed significantly since the 1970's. > There are just two reasons why >C remains in widespread use today. First, the incredible but >growing conservativeness of today's CS instructors who work >so hard at protecting their discipline from the heresy of innovation. >Second, the fact that it's still possible to make a profit delivering >buggy products. Don't close your mind to the fact that people like the language on its own merits. From what I've seen instructors are driven by demand and not not the other way around. C survives despite the fact that it is no longer the trendy language, instructors are much more interested in teaching C++ or Java. -- ----------------------------------------- Lawrence Kirby | fred@genesis.demon.co.uk Wilts, England | 70734.126@compuserve.com ----------------------------------------- ^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: [++] Tight coding 1998-03-02 5:00 ` [++] Tight coding Peter Moylan ` (3 preceding siblings ...) 1998-03-02 5:00 ` Lawrence Kirby @ 1998-03-03 5:00 ` Larry Kilgallen 4 siblings, 0 replies; 53+ messages in thread From: Larry Kilgallen @ 1998-03-03 5:00 UTC (permalink / raw) In article <slrn6fk0pe.5t2.peter@eepjm.newcastle.edu.au>, peter@eepjm.newcastle.edu.au (Peter Moylan) writes: > Bill Moyer <billm@cygnus.com> wrote: >> [...] Use of memory segmentation would help pin- >>point which data structure (or catagory of data structures) >>was corrupted, and allow recovery routines to perhaps repair >>the damage and continue with application execution; this >>would be a big improvement over "Segmentation Fault; core >>dumped" or "GPF 314159". > > One of my major gripes about C is the strong influence it's > had on operating systems design. > > We have memory segmentation. We've had it for years. What > we don't have are operating systems that make proper use > of the segmentation hardware. I am not sure what further operating system support is needed. In User Mode (on VMS) as a programmer I can allocate memory sparsely in my virtual address space. I can set the protection of pages I choose to be read-only. Now I do _not_ want the operating system or compiler doing this behind my back to save me from my own programming errors in most cases, because the classes of errors that are easy to catch through _automated_ checking beyond language semantics are generally quite unlikely (so long as one avoids pointer arithmetic). One notable exception is stack guard pages (no-access pages to cause an exception if one overflows the stack), which I feel are generally useful. But I have those, thanks to collusion between the compiler and the operating system. I wouldn't mind having automatic stack expansion in each thread the way I have had it for 17 years in an unthreaded program. In a world of 64-bit addressing that is perfectly feasible for today's programs. I would classify that as an ease-of-programming issue, however, rather than a detection of defects issue. So I disagree that: "What we don't have are operating systems that make proper use of the segmentation hardware." Although of course not all operating systems are equal. I was under the impression that OS/400 had a rich selection of memory access controls, and I have always presumed the same for MVS. But I am quite willing to be proven wrong. Tell me what else the operating system could do for me, so I can put it on my wish list. Larry Kilgallen ^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: Wildfire and NT 1998-02-24 5:00 ` Sean Burke ` (2 preceding siblings ...) 1998-02-25 5:00 ` [++] Tight coding (Was: Re: Wildfire and NT) Terje Mathisen @ 1998-02-25 5:00 ` Maynard Handley 3 siblings, 0 replies; 53+ messages in thread From: Maynard Handley @ 1998-02-25 5:00 UTC (permalink / raw) In article <34F3B7C5.5FD1@earthlink.net>, Sean Burke <Iburke@earthlink.net> wrote: > Today, we use malloc'ed objects, storing the pointers in linked-lists, > btrees and hash tables. These data structures come with a lot of > overhead both in space and time - malloc overhead, pointer-indirection, > etc. But they are more flexible than arrays, and in modern systems, > the overhead just isn't often noticeable. One of the tenets of "modern" > coding is to avoid any kind of fixed limitations in one's code. (I > recently was annoyed to discover that a certain C compiler would not > handle literal strings over 32K bytes - imagine! :^) I think it's issues like this that people forget. Often the extra overhead of current systems is NOT simply mass stupidity on the part of all involved. It's a reflection of (1) bending over backwards to be compatible with the past (2) trying to incorporate as much flexibility as possible into what's now being done. One can compare, for example, the fairly lean dispatch of COM or BeOS (basically a vtable) with the more heavyweight dispatch of SOM or QuickTime components. Sure the former is faster and simpler to code up. But the latter allows one to grow a whole lot more cleanly. At least some of the extra crud that lives in OSs and apps is impedance matching between pieces of code written by independent groups. Sure in an ideal world everyone would get together to bypass the glue and use more efficient interfaces. In the real world this is simply not feasible. The other part of course is that we simply want more. You can write an MPEG decoder that plays forward in maybe 50K of code. But if you also want it to play backward, that's not just another 5K---it's a re-architecting that doubles the size. If you add in frame-accurate random access, you double the size again. If you want the video and audio to be able to be piped through third party pieces of code that can then apply their own effects to them, you double the code size again. I am not personally familar with NT, apart from just knowing the overall ideas. However I suspect that the people claimining it's "all of UNIX" only 5 times as large are being disingenous. My suspicion is that the parts that are directly comparable to UNIX are of similar size, but that there are large parts that are NOT comparable to UNIX. For example the file system is a whole lot richer. Or the crud in there to deal with DOS/Win95 apps. I think such complaints would be a whole lot more useful if people were to specify exactly how pieces of software being compared to each other differed in functionality. (Finally let me say that I would not disagree with the assessment that much modern code sucks---I was flabbergasted at being shown a project that generates the user interface for some network code that consisted of over 1000 files! It seemed to be based on adding together the code from 20 previous projects with no attempt to winnow the results. This stuff does happen. However there are also architectural differences between what MacOS or WinNT are trying to do and what UNIX is trying to do, and those differences are not purely stupidity, and they are not free in code space and time.) Maynard -- My opinion only ^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: Wildfire and NT 1998-02-24 5:00 ` brianh ` (2 preceding siblings ...) 1998-02-24 5:00 ` Sean Burke @ 1998-02-25 5:00 ` Bernd Paysan 1998-02-25 5:00 ` brianh 1998-02-27 5:00 ` Paul Kahler 4 siblings, 1 reply; 53+ messages in thread From: Bernd Paysan @ 1998-02-25 5:00 UTC (permalink / raw) brianh@bit3.com wrote: > *Bzzt* Thank you for playing, but that answer is incorrect. > > If you feel the need to disagree, please post the 3,000 line program that > delivers the same functionality of the Linux kernel. Bad example. The Linux kernel already is an order of magnitude smaller than the corresponding parts of NT. But if you want to see a ~3,000 line program that delivers about the same functionality as OSF/Motif (I suppose more than 30,000 lines), just look at my MINOS widget library (you can download it from my homepage). -- Bernd Paysan "Late answers are wrong answers!" http://www.jwdt.com/~paysan/ ^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: Wildfire and NT 1998-02-25 5:00 ` Bernd Paysan @ 1998-02-25 5:00 ` brianh 1998-02-26 5:00 ` Doug 1998-02-26 5:00 ` Bernd Paysan 0 siblings, 2 replies; 53+ messages in thread From: brianh @ 1998-02-25 5:00 UTC (permalink / raw) In article <34F3E964.7EF0@remove.muenchen.this.org.junk>, Bernd Paysan <bernd.paysan@remove.muenchen.this.org.junk> wrote: >brianh@bit3.com wrote: >> *Bzzt* Thank you for playing, but that answer is incorrect. >> >> If you feel the need to disagree, please post the 3,000 line program that >> delivers the same functionality of the Linux kernel. > >Bad example. The Linux kernel already is an order of magnitude smaller >than the corresponding parts of NT. > Yes, but there's no way on god's green earth that Linux could be written in 3,000 lines of code- at least not with any programming languages available today. Perhaps in 2035 you'll be able to do Linux 2.0.32 in 3,000 lines of code- but not today. With today's technology, Linux is a multi-hundred-thousand line project. >But if you want to see a ~3,000 line program that delivers about the >same functionality as OSF/Motif (I suppose more than 30,000 lines), just >look at my MINOS widget library (you can download it from my homepage). Does it take advantage of advanaces in computer languages that Motif does not/could not- specifically, object orientation? Remember that Motif is written in C. I do not doubt that there are a large number of 300,000 line projects that could be (better) done as 3,000 line projects. That does not mean that all 30,000 line projects can be done as 3,000 line projects. I don't speak for Bit 3. Brian ^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: Wildfire and NT 1998-02-25 5:00 ` brianh @ 1998-02-26 5:00 ` Doug 1998-02-26 5:00 ` Jeffrey S. Dutky 1998-02-26 5:00 ` Bernd Paysan 1 sibling, 1 reply; 53+ messages in thread From: Doug @ 1998-02-26 5:00 UTC (permalink / raw) brianh@bit3.com wrote: > With today's technology, Linux >is a multi-hundred-thousand line project. Yeah, but with 100 monkeys all typing in parallel, it didn't take too long to write.... ^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: Wildfire and NT 1998-02-26 5:00 ` Doug @ 1998-02-26 5:00 ` Jeffrey S. Dutky 0 siblings, 0 replies; 53+ messages in thread From: Jeffrey S. Dutky @ 1998-02-26 5:00 UTC (permalink / raw) Doug wrote: > > brianh@bit3.com wrote: > > > With today's technology, Linux > >is a multi-hundred-thousand line project. > > Yeah, but with 100 monkeys all typing in parallel, it > didn't take too long to write.... Actually, the monkeys weren't typing in parallel, they were using in parallel. The trick with Linux hasn't been to get a huge base of coders WRITING in parallel, but to get a huge base of users TESTING in parallel. 10,000 monkeys all installing and running in parallel can catch a lot of bugs. When a fair fraction of those monkeys are technically oriented and have the kernel source, most of the bugs that get caught also get fixed. See "The Cathedral and the Bazzar" by Eric Raymond for further clarification. <http://earthspace.net/~esr/writings/cathedral-bazaar> - Jeff Dutky ^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: Wildfire and NT 1998-02-25 5:00 ` brianh 1998-02-26 5:00 ` Doug @ 1998-02-26 5:00 ` Bernd Paysan 1998-02-27 5:00 ` brianh 1 sibling, 1 reply; 53+ messages in thread From: Bernd Paysan @ 1998-02-26 5:00 UTC (permalink / raw) brianh@bit3.com wrote: > Does it take advantage of advanaces in computer languages that Motif > does not/could not- specifically, object orientation? Remember that > Motif is written in C. Yes, certainly. MINOS is written in an OO extension of Forth, which itself loads on standard Forth - it's only 600 lines, either. However, Motif is written based on Xt, which has some sort of "poor man's object oriented C" features. A properly done special purpose OO extension can make C programs nearly as compact as C++ programs. Not that I would say Xt and Motif are properly done ;-). -- Bernd Paysan "Late answers are wrong answers!" http://www.jwdt.com/~paysan/ ^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: Wildfire and NT 1998-02-26 5:00 ` Bernd Paysan @ 1998-02-27 5:00 ` brianh 1998-03-01 5:00 ` Ketil Z Malde 0 siblings, 1 reply; 53+ messages in thread From: brianh @ 1998-02-27 5:00 UTC (permalink / raw) In article <34F53948.47E4@remove.muenchen.this.org.junk>, Bernd Paysan <bernd.paysan@remove.muenchen.this.org.junk> wrote: >brianh@bit3.com wrote: >> Does it take advantage of advanaces in computer languages that Motif >> does not/could not- specifically, object orientation? Remember that >> Motif is written in C. > >Yes, certainly. MINOS is written in an OO extension of Forth, which >itself loads on standard Forth - it's only 600 lines, either. > >However, Motif is written based on Xt, which has some sort of "poor >man's object oriented C" features. A properly done special purpose OO >extension can make C programs nearly as compact as C++ programs. Not >that I would say Xt and Motif are properly done ;-). Motif is a wonderful example that you can do OO programming in a non-OO language, but that there are reasons for using an OO language, IMHO. And it was known decades ago (and is busily being rediscovered by my generation) that the programming language you use greatly affects your productivity- The author of "The Mythical Man Month" (which should, IMHO, be required reading of all computer programmers) whose name escapes me at the moment, claimed with proof that PL/1 programmers were 5 times more efficient than assembly language programmers- not because they were intrinsicly better programmers (they produced on average the same number of lines of code per year), but because each line of PL/1 code was worth five lines of assembler. I'll also not argue that professional programmers use language tools 10-20+ years out of date. There is a philosophy of "I'm so busy writting code I don't have time to learn how to write code better"- a self-defeating attitude if ever there was one. However, I state bodly that there are still programs that take 30,000 lines of code in OO-Forth (they just took 300,000 lines in C++ and 3,000,000 lines in C). There are even programs that take 300,000 lines. My original statement- that 30,000 line programs are intrinsicly different to write than 3,000 line programs, and that there is another such difference between 30,000 line programs and 300,000 line programs, remains. The "next order of magnitude" (3,000,000 line programs) I have philospohical problems with. I beleive (with some justification) that we (humans) are unable to design and build programs more complex than the complexity a single human can deal with. A single human being can understand a 300,000 line program (you need a talented human being and he/she needs to work at it, but it can be done)- I don't think this is true at 3,000,000 lines. >"Late answers are wrong answers!" Wrong answers are also late answers... I don't speak for Bit 3. Brian ^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: Wildfire and NT 1998-02-27 5:00 ` brianh @ 1998-03-01 5:00 ` Ketil Z Malde 0 siblings, 0 replies; 53+ messages in thread From: Ketil Z Malde @ 1998-03-01 5:00 UTC (permalink / raw) The Mythical Man-Month, Frederick P. Brooks, Jr. Addison Wesley, 1995 ISBN 0-201-83595-9 ~kzm ^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: Wildfire and NT 1998-02-24 5:00 ` brianh ` (3 preceding siblings ...) 1998-02-25 5:00 ` Bernd Paysan @ 1998-02-27 5:00 ` Paul Kahler 1998-03-02 5:00 ` Joel Gallun 4 siblings, 1 reply; 53+ messages in thread From: Paul Kahler @ 1998-02-27 5:00 UTC (permalink / raw) In comp.arch brianh@bit3.com wrote: : In article <6csl81$rb9@news-rocq.inria.fr>, : Robert Harley <harley@pauillac.inria.fr> wrote: : >brianh@bit3.com writes: : >>[...] : >>Speaking from painful, personal experience, writing a 30,000 line program is : >>a vastly different undertaking than writing a 3,000 line program. : > : >However a talented programmer will write a 30,000 line program that : >fits in 3,000 lines. : *Bzzt* Thank you for playing, but that answer is incorrect. : If you feel the need to disagree, please post the 3,000 line program that : delivers the same functionality of the Linux kernel. The linux kernel was written by talented programmers. It's the 300,000 line program that got written in 30,000 :-) I will agree that the ratio is often less than 10 to 1, but 2:1 or 3:1 is VERY common in the OPS (other peoples stuff) that I've run across. Occasionally I see stuff that should be 10-20 times smaller, but it was usually written with a LOT of cut-and-paste. ___ __ _ _ _ | \ / \ | | | || | phkahler@oakland.edu Engineer/Programmer | _/| || || |_| || |__ " What makes someone care so much? |_| |_||_| \___/ |____) for things another man can just ignore. " -S.H. ^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: Wildfire and NT 1998-02-27 5:00 ` Paul Kahler @ 1998-03-02 5:00 ` Joel Gallun 1998-03-02 5:00 ` Przemek Klosowski 0 siblings, 1 reply; 53+ messages in thread From: Joel Gallun @ 1998-03-02 5:00 UTC (permalink / raw) phkahler@oakland.edu (Paul Kahler) writes: > The linux kernel was written by talented programmers. It's the 300,000 > line program that got written in 30,000 :-) /usr/src/linux> (find . -name '*.[chSs]' -exec cat {} \;)|wc -l 815720 Looks like you are off by an order of magnitude. Linux 2.0.33 -- Joel Gallun joel@tux.org Open system and Internet consulting Washington, D.C. ^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: Wildfire and NT 1998-03-02 5:00 ` Joel Gallun @ 1998-03-02 5:00 ` Przemek Klosowski 0 siblings, 0 replies; 53+ messages in thread From: Przemek Klosowski @ 1998-03-02 5:00 UTC (permalink / raw) Joel Gallun <joel@gwyn.tux.org> writes: > phkahler@oakland.edu (Paul Kahler) writes: > > > The linux kernel was written by talented programmers. It's the 300,000 > > line program that got written in 30,000 :-) > > /usr/src/linux> (find . -name '*.[chSs]' -exec cat {} \;)|wc -l > 815720 > > Looks like you are off by an order of magnitude. Linux 2.0.33 That isn't a fair metric; it counts all architectures, and all possible drivers. I propose this: /usr/src/linux> for a in arch/* [b-z]* ; do echo -n $a ; (find $a -name '*.[chSs]' -exec cat {} \;)|wc -l ; done to obtain the followint result (2.0.32) arch/alpha 12062 arch/i386 29414 arch/m68k 59494 arch/mips 7705 arch/ppc 10939 arch/sparc 21771 drivers 446492 fs 68177 include 43496 init 1078 ipc 2405 kernel 7282 lib 1829 mm 7051 net 56845 scripts 5359 So, we see that the majority of code is in hardware drivers, with significant chunks in handling foreign filesystems (18 are supported by Linux!---win(4)/mac/os2/bsd/cdrom/nfs) network, etc. If we count the 'microkernel' part (kernel, memory management, ipc, initialization, ext2 filesystem, and architecture from say i386, excluding the math coprocessor emulation) is around 35-40 kLOC, for whatever it is worth. -- przemek klosowski <przemek@nist.gov> (301) 975-6249 NIST Center for Neutron Research (bldg. 235), E111 National Institute of Standards and Technology Gaithersburg, MD 20899, USA .. and for spam extractors, FCC Commisioners' email is: wkennard@fcc.gov,sness@fcc.gov,pmisener@fcc.gov,mpowell@fcc.gov ^ permalink raw reply [flat|nested] 53+ messages in thread
end of thread, other threads:[~1998-03-04 5:00 UTC | newest] Thread overview: 53+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 1998-02-23 5:00 Wildfire and NT Robert Harley 1998-02-24 5:00 ` brianh 1998-02-24 5:00 ` David Hinds 1998-02-25 5:00 ` Del Cecchi 1998-02-25 5:00 ` brianh 1998-02-24 5:00 ` Bill Moyer 1998-02-25 5:00 ` Larry Kilgallen 1998-02-25 5:00 ` brianh 1998-02-25 5:00 ` Epiphanies (was: Wildfire and NT) Carlie Coats 1998-02-25 5:00 ` Wildfire and NT John Hascall 1998-02-25 5:00 ` Rob Rodgers 1998-02-24 5:00 ` Sean Burke 1998-02-25 5:00 ` brianh 1998-02-25 5:00 ` Mike Albaugh 1998-02-25 5:00 ` [++] Tight coding (Was: Re: Wildfire and NT) Terje Mathisen 1998-02-28 5:00 ` Piercarlo Grandi 1998-03-01 5:00 ` [++] Tight coding Bill Moyer 1998-03-01 5:00 ` Ruud Bruijnesteijn 1998-03-01 5:00 ` scott 1998-03-02 5:00 ` Terry Moore 1998-03-02 5:00 ` Pete Becker 1998-03-03 5:00 ` Ruud Bruijnesteijn 1998-03-03 5:00 ` Pete Becker 1998-03-04 5:00 ` Terry Moore 1998-03-03 5:00 ` Pete Becker 1998-03-04 5:00 ` Ruud Bruijnesteijn 1998-03-02 5:00 ` Kaz Kylheku 1998-03-02 5:00 ` Martin Tom Brown 1998-03-02 5:00 ` Kaz Kylheku 1998-03-01 5:00 ` Larry Kilgallen 1998-03-01 5:00 ` [++] Tight coding (comp.sys.dec-only thread) Bill Moyer 1998-03-02 5:00 ` [++] Tight coding Peter Moylan 1998-03-02 5:00 ` Martin Harvey 1998-03-02 5:00 ` Scott Fluhrer 1998-03-02 5:00 ` Kaz Kylheku 1998-03-02 5:00 ` Lawrence Kirby 1998-03-02 5:00 ` Peter Moylan 1998-03-02 5:00 ` Ketil Z Malde 1998-03-04 5:00 ` Lyn A Headley 1998-03-02 5:00 ` Kaz Kylheku 1998-03-03 5:00 ` Lawrence Kirby 1998-03-03 5:00 ` Larry Kilgallen 1998-02-25 5:00 ` Wildfire and NT Maynard Handley 1998-02-25 5:00 ` Bernd Paysan 1998-02-25 5:00 ` brianh 1998-02-26 5:00 ` Doug 1998-02-26 5:00 ` Jeffrey S. Dutky 1998-02-26 5:00 ` Bernd Paysan 1998-02-27 5:00 ` brianh 1998-03-01 5:00 ` Ketil Z Malde 1998-02-27 5:00 ` Paul Kahler 1998-03-02 5:00 ` Joel Gallun 1998-03-02 5:00 ` Przemek Klosowski
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox