Slashdot Mirror


The New C Standard

derek_farn writes "At a very late stage Addison Wesley decided not to publish my book, 'The New C Standard: An economic and cultural commentary'. Now that the copyright issues have been sorted out I am making the pdf freely available. You can download the pdf (mirror 1). The organization is rather unusual in that the commentary covers each sentence of the C Standard (actually the latest draft of C0X, excluding library) one by one (all 2022 of them). One major new angle is using the results from studies in cognitive psychology to try and figure out how developers comprehend code. The aim being to try and produce some coding guidelines that reduce costs (ie, reduce the time needed and bugs created). The book also contains the results of lots of measurements (over 400 figures and tables) in an attempt to back the arguments being made -- another unusual feature since most software related books don't publish any figures to back up what they say. Other subsections discuss common implementations and differences between the latest draft standard and C90/C++. More background on the project is available from the Inquirer.

37 of 400 comments (clear)

  1. Why not self publish? by killproc · · Score: 3, Insightful

    This seems to be an interesting topic. I'm sure you could sell a few copies on Amazon...

    --
    When you die, on your deathbed, you will receive total consciousness. So I got that goin' for me, which is nice.
  2. Why would you use this? by Anonymous Coward · · Score: 5, Funny

    C is over with already, geez. Slow, cumbersome, and nobody has a compiler for it. You should be switching to Java by now. It's fast, portable, and the JVM is everywhere. The Novell JVM is the fastest. Dennis Ritchie's time is past. Let the dinosaur turn into oil already and upgrade to the technology that will take us into the 22nd century and beyond. JAVA!

    1. Re:Why would you use this? by satan666 · · Score: 5, Funny

      Puh-leaze! Java-this and Java-that. Why not use a language that is designed for speed: COBOL

    2. Re:Why would you use this? by Anonymous Coward · · Score: 4, Insightful

      C has a lot of shortcomings, like being only weakly-typed, etc.

      Maybe somebody should write a book once about why people should switch away from C to more modern languages.


      You may view such things as shortcomings. I view them as power. Power that can be used for good or for ill.

      Modern languages are all about protecting the programmer from having power. They limit the programmer, tying him or her down. This was done because so many programmers are idiots, true, but never forget that the problems modern languages were meant to solve are all people problems, not computer problems.

      It is people that seem to need object oriented structures, because the language needs to help protect the programmers from their failure to organize data structures in a sensible way and communicate that structure to other programmers. People that seem to require strongly-typed languages, to prevent their errors of inattention while they write code. But all these features are unknown to the CPU -- they've all been stripped away in the compiler, and reduced back to the purity of sequential code. A purity that most programmers can't handle. A purity that C comes closest to (besides assembly, of course).

      As a programmer working professionally for nearly 20 years now, I find it unutterably sad that so many new programmers are let out of colleges having so little idea of how computers actually operate. They're not programmers anymore -- they're a priesthood who poke at the black boxes in certain ways and the boxes "magically" do what they're supposed to. They have as little idea of what's going on as a 5-year-old playing with a gyroscope (and I apologize to any really bright 5-year-olds out there for the comparison).

      The reduction of the use of C in our profession marks the decline of real knowledge in the average programmer.

    3. Re:Why would you use this? by The_Wilschon · · Score: 3, Insightful

      maintainability and enhanceability, at least, are entirely dependent on the quality of the programmer. I'm working on extending a package here at work, most of which is written in java. It is very poorly organized and I'm being forced to completely rethink the design. If it were well designed, I ought to be able to copy a couple of files and change some constants and be done. (the extension is nothing more than adding a new version of a particular custom electronics board while continuing to use the old board as well.)

      Using java does not automagically give you all of these benefits. In the hands of a competent programmer, they may be easier to acheive with java. However, in the hands of an incompetent programmer, the best you might get would be portability and mobility. That is, as long as you stick with virtual machines and class libraries from one vendor.

      There is no silver bullet.

      --
      SIGSEGV caught, terminating

      wait... not that kind of sig.
    4. Re:Why would you use this? by groomed · · Score: 3, Insightful
      Christ you're an insufferable prat. And I say that not to insult you, but to inform you, lest it had escaped your notice.

      Do you honestly believe that any of what you just said hasn't occurred to the original poster? A veteran of almost 20 years?

      This discourse is so tired and worn-out that its only purpose is to serve as joke fodder on the Internet. And this is how it's been for ages, all the way back to when the first "Real Programmers don't eat quiche" jokes were being forwarded across Bitnet.
      Let me quote Dijkstra:
      Functional programming, structured programming, logical programming, constraints programming, p-code systems, object oriented programming, iterative development, patterns, open source development, pair programming, Extreme programming, managed code: each of these was heralded as the sine qua non of software development at its inception, only to get bogged down in messy detail once people actually started to build real-world systems with them. Bits and pieces survive here and there and percolate up in newer languages and designs, until every hint of the original glamour has vanished and they become just another fixture for pigeons to shit on.

      And this is how progress is made, slowly and erratically, like a blind man groping about in the dark.

      Fred Brooks was right: there is no silver bullet.
  3. Mirror of pdf here by derek_farn · · Score: 5, Informative

    There is another mirror of the pdf here thanks to the folk at mirrordot.

  4. Did you consider.... by Anonymous Coward · · Score: 5, Interesting

    ...going to another publisher?

    I used to be a development editor (10-15 years ago) - a real one; i.e. a software developer recruited to improve developer-level books, not a editor carrying the title. I would have been interested in providing up-front assistance to you and helping you get it ready for someone else. Most of the non-textbook (IDG, Que, SAMS, etc.) publishers prefer to have things come in chapter-by-chapter so things can be directed along the way, but with feedback prior to submittal, you could have gotten around that. You could have made some money that way.

    1. Re:Did you consider.... by tcopeland · · Score: 4, Informative

      > You could also consider "self-publishing"

      Right on! You can get a run of 1000 copies of a soft cover book printed by someone like BookMasters for $5K or so, even for a monster like this one. Just stick with a 4 color cover and black/white in the text. And if you can charge $40 or so for this tome, you can cover your printing costs after selling only 150 copies.

      [plug]
      That's what I'm doing with PMD Applied; seems to be working out well so far.
      [/plug]

  5. Re:Thinly Veiled Job Request by DenDave · · Score: 5, Insightful

    So maybe it is a guideline to hobby C coders, new learners, anyone who doesn't use C as professional??

    I think there is a target audience, perhaps you don't fall in the category but that doesn't mean that everyone who dabbles with C is Uber-Geek..

    --
    -if at first you don't succeed, stay the heck away from paragliding.
  6. One Thousand Sixteen Pages? by mbessey · · Score: 4, Insightful

    Good grief. I can see why the publisher bailed on this. I wonder how much they would have had to charge for it?

    -Mark

  7. Re:Again...? by saider · · Score: 3, Informative

    This is ANSI C. It gets refreshed every so often to incorporate some changes. One of the easiest changes to spot is the following...

    for(int i = 0; i MAX_COUNT, i++ )

    In the olden days, you'd have to declare i before using it in the code. The newer standards let you declare variables at their first use. This serves to clean up the code a little and also lets the programmer see what type it is without having to scroll up to the top of the function.

    There's lots of other little changes like that in the various "standards".

    --


    Remember, You are unique...just like everyone else.
  8. Actually....One Thousand Six Hundred and Sixteen by Rolan · · Score: 3, Informative

    1616 pages....

    --
    - AMW
  9. 1616 by mnemonic_ · · Score: 4, Funny

    That's the number of the beast multiplied by 2.426! Incredible!

  10. "The New" by hey · · Score: 3, Insightful

    I don't know if I trust a style guide with "The New" in the title. Nothing stays new forever.
    What about when the next version of C comes out?
    You'll have to go back a revise the title! Why not do it right the first time and call it "C90/C++ Style" or something.

    Maybe times when cleaning up other people's files I have run into files with "new" in the name... dated years ago. A sure sign it can be deleted.

  11. Re:Interesting outlook by Kupek · · Score: 4, Insightful

    Computers don't comprehend code, they just run it. Comprehension is an entirely different act than execution. While we build up our comprehension one line (or word) at a time, we're still using our recollection of all previously related code to understand what this new piece of code does. And then, once we think we understand what's going on, I think we often mentally throw out the code itself, and just remember what it does.

  12. Re:Thinly Veiled Job Request by ekephart · · Score: 3, Insightful

    Right, or someone like me, who is young yet fairly competent with C. As a style guide/commentary I see no harm in Mr. Jones sharing his insights. What college grad wouldn't benefit from the teachings of experience.

    --
    sig
  13. I'm waiting for D by winkydink · · Score: 4, Funny

    I don't think this C-thing is going to catch on. :)

    --

    "I'd rather be a lightning rod than a seismometer." -Ken Kesey

  14. C0X by zephc · · Score: 4, Funny

    It seems that some men love C0X, but most men want nothing to do with C0X. The men that like C0X say there's nothing like the feel of the thick C0X standard in your hands.

    --
    "I would say that 99 per cent of what my father has written about his own life is false." - L. Ron Hubbard Jr.
  15. Nice to have on the bookshelf...for a few of us by museumpeace · · Score: 3, Insightful
    My occasional run-ins with languages go back to the days of BLISS and kicking around the Strawman and Ironman RFPs. I think there is a lot of value in a work like this for CS professors and software CTOs and maybe some flavors of project technical leads but at 1600 pages, not many of the rest of us would run out to buy it. ACM would seem a likely home for such a book...it reads like one of their Computing Surveys articls that got out of hand. [any book with > 1400 reference citations is definitely in the academic tome category...not sure I can fault AW's decision as a purely business decision. ON the other hand, the contents here are a musty treasure and I downloaded it immediately. I am grateful for this.]
    Also, choosing to make deep commentary on the suitability of a computer language as a tool for solving problems but then going light on the dominant OO languages is just too big an omission. e.g. on pg 24:
    Your author's experience with many C developers is that they tend to have a C is the only language worth knowing attitude. This section is unlikely to change that view and does not seek to. Some knowledge of how other languages do things never hurt.

    There are a few languages that have stood the test of time, Cobol and Fortran for example. While Pascal and Ada may have had a strong influence on the thinking about how to write maintainable, robust code, they have come and gone in a relatively short period of time. At the time of this writing there are six implementations of Ada 95. A 1995 survey[571] of language usage found 49.5 million lines of Ada 83 (C89 32.5 million, other languages 66.18 million) in DoD weapon systems. The lack of interest in the Pascal standard is causing people to ask whether it should be withdrawn as a recognized standard (ISO rules require that a standard be reviewed every five years). The Java language is making inroads into the embedded systems market (the promise of it becoming the lingua franca of the Internet does not seem to have occurred). It is also trendy, which keeps it in the public eye. Lisp continues to have a dedicated user base 40 years after its creation. A paper praising its use, over C, has even been written.[398]

    The references for the other languages mentioned in this book are: Ada,[625] Algol 68,[1347] APL,[634] BCPL,[1113] CHILL,[636] Cobol,[614] Fortran,[620] Lisp[630] (Scheme[693]), Modula-2,[626] Pascal,[619] Perl,[1375] PL/1,[613] Snobol 4,[504] and SQL.[621]
    Since we all mostly program in OO paradigms these days, the author's perspectives on C++, though they would lengthen an already long book, should have been prominently featured instead of downplayed.
    --
    SLASHDOT: news for people who can't concentrate on work or have no life at all and got tired of yelling back at the TV.
  16. shoulda used booksurge by MatD · · Score: 3, Insightful

    You could have published your book yourself through booksurge, and sold it on Amazon.com. At least that way, you'd actually get payed for all the work you did on it.

    --
    Since when did operating systems become a religion?
  17. Re:can anyone set up a .torrent ? by mwilliamson · · Score: 4, Informative
  18. You don't need new standards by GamblerZG · · Score: 5, Interesting

    What you really need is a new language.

    Before modding me down, think about it. Any programming language is about solving problems, and problems you solve today are different from the ones someone had back in the days of C creation. Moreover, the ways you deal with programming changed as well. IT industry needs new languages, including low-level and compiled ones.

    1. Re:You don't need new standards by RAMMS+EIN · · Score: 3, Interesting

      Agreed, we need a new language. All this writing applications in C is no good. Just think about all the security flaws that could have been avoided if we used a language in which buffer overruns, format strings, pointer arithmetic, unsafe casts, and memory leaks just didn't exist.

      C also suffers from lack of flexibility. Try implementing a Java-style class system in C; although you can make something that works the same, using it will always be more cumbersome. Because of this, C will always be pretty low-level, it is just not adaptable enough to be used for really high-level things.

      On the other hand, C isn't ideal for low-level programming either. Try writing properly tail recursive functions in C, or try composing a function call. Or, do something with the registers in your CPU.

      And then there's the syntax of the language. Try writing a parser that can correctly parse any valid C program. Or try to write a program that does transformations on C programs, both reading and writing C code.

      --
      Please correct me if I got my facts wrong.
    2. Re:You don't need new standards by dasunt · · Score: 4, Interesting
      Before modding me down, think about it. Any programming language is about solving problems, and problems you solve today are different from the ones someone had back in the days of C creation. Moreover, the ways you deal with programming changed as well. IT industry needs new languages, including low-level and compiled ones.

      I thought about it.

      You first declared that we need a new language based on the assumption that we are solving different problems from a decade ago. (C99 was released about that long ago, and GCC supports much of the C99 spec).

      Yet, thinking about it, you didn't tell us how problems are different from a decade ago.

      Nor did you tell us how these problems present difficulties in the upcoming C0X spec.

      The amazing thing about C is that it has survived several 'languages of the year'. It obviously has some advantages. It seems to me that C is a proven tool in the programmer's workshop. It doesn't solve all problems, but no tool does. However, it solves a lot of problems very well.

  19. Not Again... by uberdave · · Score: 5, Funny

    No. This is obviously the NEW C standard they've been talking about. I haven't read the article, but clearly they've loosend up on punctuation. Also, any comparisons to directives starting with MAX must automatically default to a "less than" comparison.

  20. The Book's WWW homepage by nadamsieee · · Score: 4, Informative

    The book's homepage can be found here: http://www.knosof.co.uk/cbook/cbook.html

  21. Re:Cool but to what point? by hungrygrue · · Score: 3, Insightful

    Yea, C is a dead language. Which explains why it is also the most widely used programming language, and why there are more lines of code in active use than any other programming language.

  22. Author comments by derek_farn · · Score: 4, Informative
    I have been receiving two kinds of email:
    • Requests for a dead tree version of the pdf. I have invested the possibility of self publishing. The problem is that these companies are not set up for high page counts (1,616) and an A4'ish page size (ok, and self-publishers are currently offering a less than stunning deal; the ROI is small).

      People could try ordering from Amazon, the ISBN number is 0201709171. Perhaps Addison Wesley will change their mind if enough order are received.

    • Information on typos. Please keep sending these to me. I am keeping a log of these so that writers of grammar checkers have some real world data.
  23. Availability through LULU by ewilts · · Score: 5, Informative

    Have you considered making the book available through http://www.lulu.com/? It's a print-on-demand service that allows people an easy way to get a properly bound printed copy of your book, and for you optionally to get some money for your efforts. No cost to you to get set up either.

    No, I don't work for lulu or have any financial connections to them. I just know one of the guys that works there (Jeremy Hogan, formerly from Red Hat).

    --
    .../Ed
  24. At over 1600 pages?! by mariox19 · · Score: 4, Insightful

    Not counting the citations at the end, the book is 1,577 pages of "guidelines." Who's got that kind of time for a hobby? Who, having a job as a programmer, even has the time to read a book like that?

    How about somebody writing a book called The New Writing Standard for Books on Programming? Most of the programming books I own are unecessarily long winded, but this book takes the cake!

    --

    quiquid id est, timeo puellas et oscula dantes.

  25. Some thoughts by mnmn · · Score: 3, Insightful

    I havent read the book. But some thoughts on that post:

    The aim for C should not simply be to reduce the time spent on code, the simplistic economic view. Leave that to Java. C is for a clear and thorough understanding of the code's execution, more so than C++. The execution flow can very clearly be seen in this structured language which does not try to be smart or do things behind the wall in the compiler. C is brutal and raw, therefore low level and powerful. Leave it to that. C is great for kernel level programming, drivers and embedded systems, and other places where you get anal about control over whats happening. C is awesome when you need to mingle the code with assembly in tight spots and still keep things readable.

    Please do not turn it into Java. Programmers who need to spend less time can just use Visual Basic or equivalents.

    I like the idea of commenting on all parts of the standard. But you said you used a cognitive analysis of some sort. More so than that, I'd look for comments from experienced developers, maybe people who worked on various kernels and drivers, integrated various languages with C, developed C libraries and worked on a hundered-file projects.

    --
    "Give orange me give eat orange me eat orange give me eat orange give me you." -Nim Chimpsky
  26. Pretty Damn Impressive by Anonymous Coward · · Score: 4, Interesting

    I've only been skimming it for a little bit now, but this book seems extremely interesting.

    It probably would have gotten a lot more love during editing by the publisher, as, IMHO, it's fairly difficult to approach and digest in its current form. Maybe I just don't get it yet, but it does seem to suffer a bit due to its organization.

    That said, the information in here is absolutely enthralling. I went over a few of the more subtle parts of the standard that I know fairly well, and I was impressed. The explanations are good, but what I really find compelling are the examples, historical anecdotes, references to different machines and architectures, and juxtapositions with other languages. You can tell that this guy knows this stuff, but more importantly, he's *lived* it.

    The comments about this book not being useful to a "good C programmer" completely miss the mark. A good C programmer -- one that has a true love for programming -- will most likely find this book captivating.

  27. Manifestation of liturgical commentary. by blackest+sun · · Score: 4, Interesting

    At a glance, this is impressive not so much for content as for format. In essence this book is a Talmudic http://en.wikipedia.org/wiki/Talmud breakdown of interpretation.

  28. Now that the copyright issues have been sorted out by Trinition · · Score: 3, Funny

    Now that the copyright issues have been sorted out...

    As I was reading this sentence, my heart stopped and my mind jumped for joy. I thought the RIAA/MPAA/etc. had finally given up, congress had rolled back copyright terms, and the GPL was finally successfully tested in court.

    Then I read the rest... *sigh* oh well.

  29. Why Addison-Wesley rejected this by Animats · · Score: 4, Interesting
    It's clear why Addison-Wesley rejected this. The author is a terrible writer. He has a fondness for run-on sentences, fails to use commas appropriately, and makes several grammatical mistakes per page.

    I'm up to page 132, and so far, it's an introductory cognitive psychology text. A bad one.

    There are 1616 pages of this drivel. Even for someone interested in programming language design, this is a painful read.

    There's room for a good book in this area, but this isn't it. A more useful approach might be to start from Amit Yoran's statement that "About 95% of software bugs come from 19 common, well-understood" programming mistakes", and evaluate language designs against that.

  30. 19 known problems cause most bugs by Animats · · Score: 3, Informative
    I've been trying to get that information. Yoran said that when he was head of the National Cyber Security Division at the Department of Homeland Security. He quit shortly thereafter, and his replacement is a TV producer. At this point, it's not even clear that there is a National Cyber Security Division at DHS. It's no longer in their table of organization.

    Apparently, there were objections from Microsoft when DHS started to point out that Microsoft was the problem. What's left of the "National Cyber Security Division" actually seems to be CMU's CERT plus a front man, Andy Purdy, in Washington.