from Hacker News

This needs some heavy checking... (line 1029)

by dennis_moore on 2/9/22, 7:46 PM with 63 comments

  • by codingkev on 2/9/22, 9:08 PM

    You can link directly to a line by appending #<line_number>

    https://github.com/torvalds/linux/blob/f4bc5bbb5fef3cf421ba3...

  • by lapetitejort on 2/9/22, 9:21 PM

    I spied a goto. Ctrl/Command+F spies 60 gotos. CS students: point to the Linux source code if your professor ever gives you grief about gotos.
  • by dennis_moore on 2/9/22, 7:46 PM

    I find it mildly entertaining to casually browse random 17-year-old code lying at the heart of the Linux kernel and encounter gems like this.
  • by boricj on 2/9/22, 9:21 PM

    As someone who has done some OS development and sysadmin work, I can relate to that quote. The 1st edition of Unix is over 50 years old and some of the legacy cruft that has accumulated since is so sedimented I swear it's going to turn into oil any minute now.
  • by dgellow on 2/9/22, 9:22 PM

        /*
        * Samma på svenska..
        */
  • by turdnagel on 2/9/22, 9:47 PM

    A meta comment on the comments on this article: as one might expect post-"goto fail"[1] there are a lot of people saying "hey this should be refactored, no goto!" I thought that at first when looking at the code, given what I remember of the Apple SSL vulnerability, and how "goto" has a smell. But, as it turns out, there are sane reasons to use goto in systems programming, especially as a kind of cleanup / finally block. TIL.

    [1] https://news.ycombinator.com/item?id=7282005

  • by flerchin on 2/9/22, 9:24 PM

    In a modern codebase, would there be tests for code like this? Is it too late for a plucky contributor to start adding them?
  • by flerchin on 2/9/22, 9:20 PM

    I guess it's too scary to touch, but I feel like such code could be refactored to not use goto, amongst other issues.