Slashdot Mirror


Linus Torvalds In Sweary Rant About Punctuation In Kernel Comments (theregister.co.uk)

An anonymous reader shares a report on The Register: Linus Torvalds has unleashed a sweary rant on the Linux Kernel Mailing List, labelling some members "brain-damaged" for their preferred method of punctuating comments. "Can we please get rid of the brain-damaged stupid networking comment syntax style, PLEASE?" the Linux Lord asked last Friday. "If the networking people cannot handle the pure awesomeness that is a balanced and symmetric traditional multi-line C style comments, then instead of the disgusting unbalanced crap that you guys use now, please just go all the way to the C++ mode."Torvalds despises the following two comment-punctuation styles (with his comments):/* This is disgusting drug-induced
* crap, and should die
*/
and:/* This is also very nasty
* and visually unbalanced */
Torvalds prefers the following two styles:/* This is a comment */ and:/*
* This is also a comment, but it can now be cleanly
* split over multiple lines
*/

38 of 523 comments (clear)

  1. Whether he's overall crazy or not... by Anonymous Coward · · Score: 5, Insightful

    ...I happen to agree with his stance on this particular issue.

    1. Re:Whether he's overall crazy or not... by RabidReindeer · · Score: 4, Insightful

      If nasty-looking comments were the worst offense in recent Linux releases, I'd be overjoyed.

    2. Re:Whether he's overall crazy or not... by hcs_$reboot · · Score: 5, Funny

      /* no comment */

      --
      Slashdot, fix the reply notifications... You won't get away with it...
  2. I quit writing comments by Anonymous Coward · · Score: 3, Funny

    Because of shit like this. fuck you.

    1. Re:I quit writing comments by Anonymous Coward · · Score: 5, Funny

      Linus? Is that you?

  3. I don't use comments by Anonymous Coward · · Score: 5, Funny

    I like to make people work harder to figure out what I did.

    1. Re:I don't use comments by swillden · · Score: 5, Insightful

      I like to make people work harder to figure out what I did.

      I used to get a chuckle out of doing that... but then I figured out that the guy working hard to understand my code later is almost always me. I strive to write clean, clear code with useful comments to avoid making myself work harder to figure out what I did. Sometimes it even works.

      --
      Note to ACs: I usually delete AC replies without reading them. If you want to talk to me, log in.
  4. Torvalds Must Die! by Bruce+Perens · · Score: 4, Funny

    Linus has been known as an acerbic and rude individual, but he's never dared to touch the sacred unbalanced comment before. He's gotten bolder as we've taken his stuff. We really should have held the line, called an end to it before now. This is what we get for pandering to him.

    It's too late to simply eject him from kernel development. We can't have him hectoring us from the sidelines. I'm afraid that we must entirely erase Linus Torvalds from the noÃsphere.

    Think of it as evolution in action!

    rot13: whfg xvqqvat

    1. Re: Torvalds Must Die! by Bruce+Perens · · Score: 3, Funny

      Dare you to support the wretched Torvalds, infidel! You shall reap the consequences. Those who are not for us are against us! Witness my horde of angry hackers. That is, for the moment that you can...

  5. Re:Arguing over the subjective by tripleevenfall · · Score: 5, Insightful

    I'd remind him from the real world that he should be glad there are comments at all.

  6. please just go all the way to the C++ mode by vux984 · · Score: 5, Insightful

    Seeing as 'C++ mode' // comments were added to the C99 spec; this would be my preference. I've always hated all forms of /* */

    1. Re:please just go all the way to the C++ mode by Anonymous Coward · · Score: 3, Informative

      I use // for comments, and /* for disabling block of code.

    2. Re:please just go all the way to the C++ mode by tlhIngan · · Score: 5, Informative

      Am I the only one who wishes languages had different semantics for disabling code versus actual comments? Sometimes it's nice to have, plus it helps avoid the issue of having a block of code with a /* */ comment in it, then putting another /* */ around that block of code to disable it, only to find out that the first */ closed the outer comment.

      C does this quite well.

      Use

      //

      and

      /* */

      for textual comments.

      Use

      #if 0
      ....
      #endif

      for code comments.

      Bonus is many editors recognize the #If 0 idiom and automatically block-comment the code out!

      And the preprocessor is self-balancing, so every #if must have a corresponding #endif making it ideal for commenting out blocks of code.

  7. Parkinson's law of triviality by OpenSourced · · Score: 5, Funny

    At last a Linux development post where everybody can have an opinion! Gone are the obscure race conditions and unstable semaphores, where prudent programmers preferred to watch in silence and seem ignorant, rather than open their mouths and dispel all doubts.

    --
    Rome taught me patience and assiduous application to detail. Virtues which temper the boldness of great, general views.
  8. Re:So, the kernel is done? by quantaman · · Score: 3, Insightful

    No bugs left other than comment style disagreements? Rejoice, the year of Linux on the desktop can't be far!
    For what it's worth, my single contribution to the Linux kernel fucked up some white space. Torvalds didn't notice or I guess I would have woken up in the burn ward.

    Hard-to-read comments make hard-to-read code. On a large project with multiple developers that matters.

    --
    I stole this Sig
  9. Re:Arguing over the subjective by alvinrod · · Score: 4, Insightful

    Not the OP, but I don't particularly care about it in this instance (though I've got my own pet peeves in plenty of other cases), but when you work for a company or contribute to a project, you should follow their style conventions.

  10. Re:Who Cares? by Yvan256 · · Score: 4, Funny

    Yeah! It's not like the guy fucking invented Linux or something!

  11. Re:Arguing over the subjective by sunderland56 · · Score: 4, Interesting

    I both heartily agree with him, and think he's a crackpot. If you're trying to attract unpaid people to work on a project, this isn't the way to do it.

    // and, for the record, who uses c-style comments any more?
    // haven't written one in years
    // double-slash comments are the one and only improvement that c++ gave us

  12. Linus is right by jgotts · · Score: 5, Insightful

    Linus is right. I've been using the Linux kernel coding style as much as possible in all of my programming, regardless of the language, since around 1994. I get nothing but compliments.

    When it comes to the kernel, the most important thing is writing code that other people can read and modify. Anybody can write new code. It takes an artist to write code that other people can easily understand.

  13. Re:Linus the man-child by Anonymous Coward · · Score: 3, Insightful

    What happened in his childhood to arrest his development? Any shrinks in the house?

    It came in early adulthood when he confused good luck with genius. It happens all the time with the successful. They begin thinking they know more than their peers rather than they happened to be the lucky one at the right place at the right time.

  14. Re:Arguing over the subjective by Jamu · · Score: 3, Insightful

    My preference is

    /*
            this type of comment
    */

    // or this

    --
    Who ordered that?
  15. Re:indentation too? by Austerity+Empowers · · Score: 3, Informative

    At least in all my professional software development, this kind of nitpicking is par for the course. The difference is that in a corporation you can strong-arm your team, either because they report to you or because you have political clout. In free software with something that has thousands or more of contributors, all you have is screaming loudly and offensively enough to get on slashdot. Then maybe people figure out that this is how they want it done.

    Someone could scream back with valid arguments about why: /* This is a good idea,
      * we should do this! */

    I can't think of one. All I can think of is "who cares", the answer to which is "Linus" (and others), and if I don't care I should just do it their way.

  16. Torvie's got it all wrong by Tablizer · · Score: 3, Funny

    They are not comments, they are Perl.

  17. Re: Arguing over the subjective by Kjella · · Score: 5, Insightful

    Linus got an abundance of coders and by far most are paid, you can't compare it to other projects where you're lucky to get volunters at all. The kernel runs everything from cell phones to supercomputers and the markets it doesn't dominate is not the kernel's fault. He can well afford to only take high quality code that follows the style guides. Linux is simply not like most projects.

    --
    Live today, because you never know what tomorrow brings
  18. Re:Whom The Gods Destroy... by perpenso · · Score: 3, Interesting

    ...they first cause comment syntax to twist their panties into a bunch.

    Huh, I thought it was tabs vs spaces first, comment formatting second.

    80 character lines.

    I thought we all agreed to set our terminal windows to 120 characters?

  19. Re:Arguing over the subjective by TemporalBeing · · Score: 4, Insightful

    I'd remind him from the real world that he should be glad there are comments at all.

    Since for anything to get merged it must pass by Linus, he can insist that you put comments on it or it does not get merged.

    The Kernel source actually has quite a few comments, and some very funny jokes running throughout it.

    So when dealing with a BDL or core maintainers for a project, you just do what they say as if they were your employer paying you - as any professional would do; or you go do something else.

    --
    Truth is like the sun. You can shut it out for a time, but it ain't goin' away. - Elvis Presley (source: imdb.com)
  20. Many things are worse than bad comment punctuation by 140Mandak262Jamuna · · Score: 4, Interesting
    Worst comments are obsolete comments. The comment described what that function was designed to do, some 8 years ago. It has morphed since, default arguments added, the list has been replaced by multimap which was replaced by hashmap completely changing the behavior, and still the comments have not been updated.

    Next worst are ego comments. Every inline function preceded by three line comment naming the author as though he is Leo Tolstoy or she is Jane Austen.

    Next worst are trivial comments. Next worst are no comments.

    Then comes badly formatted comments.

    --
    sed -e 's/Chuck Norris/Rajnikant/g' joke > fact
  21. Re:Linus the man-child by paraax · · Score: 3, Insightful

    Not to back up the "all success is luck" meme but I would put it like this.
    There are any number of people who might have the skill to write a kernel.
    His "luck" was being the one who put in the work at the right time, caught the attention of other like-minded individuals to make it a community effort, and very effectively filled the niche that needed to be filled at the time. Without him it is fairly likely that another project would have eventually emerged, or that BSD would have been what people rallied around. And we'd then know another personality or group of personalities or company as the face of the open source operating system.
    That is not to say he doesn't have a crazy amount of skill.
    But that skill and that "luck" don't necessarily make his opinions infallible especially on something as asinine as this.

    That said, you don't like his management style don't work with him or with a company that requires you to work with him.

  22. Re:Arguing over the subjective by lgw · · Score: 4, Funny

    There is no problem that one can solve with object oriented design that cannot also be solved with structs and function pointers.

    There is no problem that can be solved with structs and function pointers than cannot also be solved with raw assembly code, written directly to disk using a sector editor (or butterflies). But it's fucking stupid to choose such a non-productive way to code if you're doing it for a living (I recommend everyone does it once for fun, though).

    The *only* advantage to object oriented design is more intuitive code organization, and that only within certain problem spaces.

    Even if you never use inheritance or polymorphism (which certainly only makes sense for certain sorts of problems), putting your functions into the same namespace as the data they operate on is always going to make for cleaner code.

    That right there is a significant win for C++.

    For almost all kinds of problems, the fact that C++ destruction can automatically release resources, so you can safely return from anywhere in a function instead of having goto fail all over the place is a significant win for C++. Too many programmers are just hopeless at getting the "clean up everything before you exit the function" right 100% of the time.

    For code organization, sometimes C++ "concepts" (static polymorphism, so no function pointers) are a nice win. Questionable whether the many lines of code you can save justifies the fact that you're writing template code, however.

    The more you look, the more places you'll find clean little wins for C++, with no performance cost.

    --
    Socialism: a lie told by totalitarians and believed by fools.
  23. Re:Linus the man-child by Archangel+Michael · · Score: 4, Interesting

    “Luck Is What Happens When Preparation Meets Opportunity" - Seneca

    If you're not prepared for opportunity, and someone else is, you call them "lucky". Probably because you were too busy with Pokemon Go!

    --
    Agent K: A *person* is smart. People are dumb, stupid, panicky animals, and you know it.
  24. Re:Arguing over the subjective by Ann+O'Nymous-Coward · · Score: 4, Informative

    I am so sick of that tired old pile of steaming crap. Just don't. It stopped being funny decades ago.

    Real programmers know that other programmers will have to support their code.

    Obey Wheaton's Law: Don't Be A Dick.

  25. Re:Arguing over the subjective by msauve · · Score: 5, Funny

    Emacs ... Use a real editor kid...

    "When I log into my Xenix system with my 110 baud teletype, both vi *and* Emacs are just too damn slow. They print useless messages like, 'C-h for help' and '"foo" File is read only'. So I use the editor that doesn't waste my VALUABLE time...Computer Scientists love ed, not just because it comes first alphabetically, but because it's the standard. Everyone else loves ed because it's ED!... When I use an editor, I don't want eight extra KILOBYTES of worthless help screens and cursor positioning code! I just want an EDitor!! Not a "viitor". Not a "emacsitor". Those aren't even WORDS!!!! ED! ED! ED IS THE STANDARD!!!"

    -Ed is the standard text editor.

    --
    "National Security is the chief cause of national insecurity." - Celine's First Law
  26. Re:Arguing over the subjective by lgw · · Score: 3, Insightful

    C++ lets you have classes that clean themselves up. The useful pattern is to do this for primitives, not complicated objects. E.g

    FileHandle file = fopen(...)

    You use file just like you would a FILE*, except you don't need to explicitly call fclose(). No clean-up block at the bottom, you just return, and fclose(file) is called as part of exiting scope. You can call fclose() if you want to for some reason, and that's safe too. It's as idiot-proof as code is going to get.

    That means you can return from any point in the code, and each such object you created will be unwound safely in the reverse order.

    It's really a huge win, and the pattern is easily adaptable to anything with reserve-release bookends.

    --
    Socialism: a lie told by totalitarians and believed by fools.
  27. Re:Arguing over the subjective by Dutch+Gun · · Score: 4, Informative

    C++ absolutely solves the "goto fail" issue. The term that describes this is RAII. C++ uses objects and smart pointers (which are just pointers wrapped in objects) to hold resources. When objects go out of scope, those resources are automatically destroyed. There's very little need to clean anything up manually with modern C++.

    --
    Irony: Agile development has too much intertia to be abandoned now.
  28. Re:It's got to be said. by phantomfive · · Score: 4, Informative

    He has influence over comments. He doesn't have influence over systemd.

    --
    "First they came for the slanderers and i said nothing."
  29. Re:Many things are worse than bad comment punctuat by Ambassador+Kosh · · Score: 3, Insightful

    I don't agree with this viewpoint at all.

    I have been working on some scientific simulator code and the comments have the math equations that a block of code is based on. It makes it so much easier to understand since it is often not obvious how an equation is mapped into implementation (things like discretization make things far more complex).

    Comments should not say what code does it should be why. I don't need you to see that your code is adding up a bunch of numbers but knowing why it is doing it is very important.

    --
    Computer modeling for biotech drug manufacturing is HARD! :)
  30. Re:Arguing over the subjective by cmiller173 · · Score: 4, Funny

    I don't know about empathy but I try to live by -- "code/comment as if your code will be maintained by a psychopath who knows where you live."

  31. Re:Arguing over the subjective by almitydave · · Score: 3, Informative

    If you need to use < or > in your slashdot comments, you need to type &lt; and &gt; since slashdot interprets the < or > as marking HTML tags. If you have Notepad++, use TextFX Convert -> Encode HTML to automatically convert code samples, e.g.:

    #include <iostream>
    #include <fstream>
    using namespace std;

    int main () {
        ofstream myfile;
        myfile.open ("example.txt");
        myfile << "Writing this to a file.\n";
        myfile.close();
        return 0;
    }

    --
    my, your, his/her/its, our, your, their
    I'm, you're, he's/she's/it's, we're, you're, they're