Slashdot Mirror


Linus Rants About C Programming Semantics (iu.edu)

jones_supa writes: "Christ people. This is just sh*t," begins Linus Torvalds in his message on the Linux Kernel Mailing List. Torvalds is grumpy because some new code added to the IPv6 subsystem has created conflicts. "The conflict I get is due to stupid new gcc header file crap," he writes. "But what makes me upset is that the crap is for completely bogus reasons." The new improved code uses fancy stuff that wants magical built-in compiler support and has silly wrapper functions for when it doesn't exist. Linus provides an alternative that contains a single and understandable conditional, which looks cleaner and generates better code.

6 of 576 comments (clear)

  1. Re:Not programming semantics, but the coder by thedonger · · Score: 1, Interesting

    .Such code is the result of coders who rely on the compiler too much, and their brains too little.

    I work in .Net -- *ducks* -- and it happens quite often that people rely on Intellisense and the fact that their code compiles as validation it is correct. We don't have to allocate memory, so we don't think about how we use objects that require database calls; we don't think about scope; there's a plug-in that will refactor code for you, so there's another crutch to give us more time to think about what we will be doing when we get off work.

    Also, get off my lawn.

    --
    Help fight poverty: Punch a poor person.
  2. Re:Not saying I disagree with Torvalds by GuB-42 · · Score: 3, Interesting

    This is someone you wouldn't want to work for.

    Actually, I don't mind working with people who rant often, as long as they have good reason to do so.
    In fact I'd rather work with people yelling at me about how shitty my code is and telling me why than a whole pasture of cows mooing about how good I am no matter what I do.

  3. Re:Linus is right. by ArsonSmith · · Score: 3, Interesting

    Much more understandable, ignored and forgotten about. Fuck that, at least his way is getting some attention which may get the shit fixed.

    --
    Paying taxes to buy civilization is like paying a hooker to buy love.
  4. Re:When create the most used operating system by gstoddart · · Score: 4, Interesting

    What the hell do you expect, "Dear Sir"?

    Look, in emails, and all the way through Usenet and frigging dial up BBS systems ... the start of a thread IS the subject line.

    I don't get this bitching about actually using the damned subject line for exactly what they've been used for 30+ years.

    Do you expect some random salutation or other piece of text completely unrelated to the body?

    We don't need a damned car analogy, we need to stop having a bunch of whiny idiots trying to redefine WTF the subject line is there for, and how it's been used for decades.

    --
    Lost at C:>. Found at C.
  5. reality by colfer · · Score: 3, Interesting

    Hannes seems to have a valid point that boundary checking should be standardized in some way. Rasmus backs him up and mentions the result of the rant is they'll end up discarding his more comprehensive work on the issue: http://lkml.iu.edu/hypermail/l...

    Linus seems to be saying all boundary checks should be ad-hoc because the new syntax is to hard to GET OFF OF HIS LAWN. Because it is dog poop.

  6. Linus is right only for people of his caliber.... by Wrath0fb0b · · Score: 5, Interesting

    Both in the technical sense and in the human sense.

    Technical: People at Linus' caliber understand exactly the rules for signed/unsigned integer promotion and where underflow is defined (as wrap) and where it's undefined[1]. Consequently he wrote perfectly-correct code for detecting the underflow and bailing out safely. Programmers at mere mortal levels of skill, however, routinely mess this up, often causing exploitable security bugs (believe me, I do code security audits as part of a real honest living). My advice for everyone (contra Linus!) is always always always use the compiler intrinsics for integer math. Feel free to decline this advice if you are a Linus level wizard (if you were, of course, you would already feel free to decline it) but if you have to wonder if you are, you probably aren't.

    Linus seems to think that the kernel should only be written by folks that don't need that kind of help -- and for that I won't argue with him. It's his baby and he can chose whether to have a small number of über-developers or a larger number of mortals. Which goes straight to the second point:

    Human: People at Linus' caliber thrive on negative feedback. At their level, positive feedback means nothing because there's nothing he can learn from someone praising his work. He wrote a kernel, he knows he's good. Meanwhile negative feedback is useful (unless trivially discountable): if the complaint is right, he'll correct something he was doing wrong; if the complaint is wrong, he'll be forced to think through why. In any event, he could never imagine why someone would sugar-coat their opinion on any matter.

    So it seems like his mode of communication is meant to answer that question for the former: he wants people of his caliber that don't write ugly code using arithmetic crutches and don't care about strongly worded criticism. There's nothing invalid about that either -- maybe it's true that the best model is that Linuses work in the kernel and the rest of us go up into userland where we use crutches like memory protection and higher-level constructs :-)

    [1] And when behavior is undefined, a smarter compiler can remove the code-path entirely -- the kernel itself was hit by such a bug where GCC legally removed a NULL check because the pointer was dereferenced before the check. See also this reference. Then there's the sad fact that people still argue against the clear language rules that say that assert( 100 + some_int > some_int ); can always be optimized away.