Poll

How many 'goto' lines are in the Linux kernel?

not many
2 (8%)
no idea
8 (32%)
a fifth of a million
7 (28%)
zero
2 (8%)
~1%
6 (24%)

Total Members Voted: 25

Author Topic: Goto bad Spooktober tale: Counting goto in the Linux kernel  (Read 3805 times)

0 Members and 1 Guest are viewing this topic.

Online RoGeorgeTopic starter

  • Super Contributor
  • ***
  • Posts: 6481
  • Country: ro
Goto bad Spooktober tale: Counting goto in the Linux kernel
« on: October 29, 2023, 07:31:47 am »
Current version of the Linux kernel at https://www.kernel.org/ is 6.5.9, download and unpack:
Code: [Select]
    wget [url]https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.5.9.tar.xz[/url]
    tar -xvf linux-6.5.9.tar.xz

Count all lines
Code: [Select]
    find ./linux-6.5.9 -name '*.c' | xargs cat | wc -l
23174856  ???

Count the goto lines
Code: [Select]
    find ./linux-6.5.9 -name '*.c' | xargs cat | grep -c 'goto '
193266   :scared:

Save them in a file for further inspection
Code: [Select]
    find ./linux-6.5.9 -name '*.c' | xargs cat | grep 'goto ' > goto.txt
Most of them are for treating errors  :P

Counting again, without goto err/out/fail
Code: [Select]
    find ./linux-6.5.9 -name '*.c' | xargs cat | grep 'goto ' | egrep -vc 'goto err|goto out|goto fail'
73786  :o

Online Siwastaja

  • Super Contributor
  • ***
  • Posts: 8335
  • Country: fi
Re: Goto bad Spooktober tale: Counting goto in the Linux kernel
« Reply #1 on: October 29, 2023, 07:37:46 am »
goto is a normal part of C and trying to avoid using it for political reasons leads to less readable spaghetti code. This is well known but some beginners still misunderstand some old tongue-in-cheek articles taken out of context.

Now for C++, amount of goto will be less as there are other ways for error handling (arguably better, arguably worse), but goto has its uses even in C++.
 
The following users thanked this post: NiHaoMike, samofab, Whales, artag, Karel, newbrain, DC1MC, audiotubes

Offline DiTBho

  • Super Contributor
  • ***
  • Posts: 4039
  • Country: gb
Re: Goto bad Spooktober tale: Counting goto in the Linux kernel
« Reply #2 on: October 29, 2023, 09:26:50 am »
What's the point here?

The linux kernel is not a good reference neither about programming style, nor about how a kernel should be written.

Linux is a kernel developped in the 90s that practically "works", and it "works" because there are a lot of people who follow it and are willing to fix it, just look at how many interactions there are every time you go into regression.

Linux v6 stopped correctly booting on PPC-G4 and G5 PowerMacs, and dozens of messages have been raining into the mailing lists for 5 months every single day... and this is precisely the correlation between writing software with lots of gotos and that approach, or writing software with a completely different approach: the first difference you notice is the number of iterations necessary to solve a bug.

Linux is certainly not written well from this point of view as it barely passes the level DO178B level E, which I remind you must be read in terms of "software life cycle" and "resources necessary for development, maintenance and bug fixing". It does not practically matter for the final user, especially for mainstream platforms (x86, amd64, arm, arm64) due to the mechanism with which it is supported by large communities, but things change dramatically when you are alone developing something or solving a problem.
The opposite of courage is not cowardice, it is conformity. Even a dead fish can go with the flow
 
The following users thanked this post: audiotubes, metertech58761

Offline DiTBho

  • Super Contributor
  • ***
  • Posts: 4039
  • Country: gb
Re: Goto bad Spooktober tale: Counting goto in the Linux kernel
« Reply #3 on: October 29, 2023, 09:45:17 am »
goto is a normal part of C and trying to avoid using it for political reasons leads to less readable spaghetti code. This is well known but some beginners still misunderstand some old tongue-in-cheek articles taken out of context.

 :-DD

I've never read anything so funny considering that it shows that it's quicker to write just any bullshit (political reasons ? LOL) than to waste time explaining things well: why waste time on a forum when the typical hourly Windirver consulting rate for DO178B/Level A is 100/hr at least? The fewer people know how to do it, the more opportunities you have to bring home wheelbarrows of gold.
The opposite of courage is not cowardice, it is conformity. Even a dead fish can go with the flow
 

Offline magic

  • Super Contributor
  • ***
  • Posts: 6931
  • Country: pl
Re: Goto bad Spooktober tale: Counting goto in the Linux kernel
« Reply #4 on: October 29, 2023, 09:55:26 am »
IMO by far the biggest problem with Linux code is very little documentation (which also suggests the distressing possibility that there may be very little design to it as well :scared:).

It's like those assholes have never heard of comments.

Of course I can read the code and see what it does, but the problem is that usually I'm reading code because it's doing something it shouldn't be doing, and good luck guessing what's the intended operation of every little part and which of those parts is wrong.

I couldn't care less about goto.
« Last Edit: October 29, 2023, 10:01:57 am by magic »
 
The following users thanked this post: DiTBho

Offline DiTBho

  • Super Contributor
  • ***
  • Posts: 4039
  • Country: gb
Re: Goto bad Spooktober tale: Counting goto in the Linux kernel
« Reply #5 on: October 29, 2023, 10:06:56 am »
IMO by far the biggest problem with Linux code is very little documentation (which also suggests the distressing possibility that there may be very little design to it as well :scared:).

It's like those assholes have never heard of comments.

Of course I can read the code and see what it does, but the problem is that usually I'm reading code because it's doing something it shouldn't be doing, and good luck guessing what's the intended operation of every little part and which of those parts is wrong.

Yup, I often see people who don't understand why there are no comments in the code and have to ask and discuss.

It's another aspect of this approach to software.
The opposite of courage is not cowardice, it is conformity. Even a dead fish can go with the flow
 

Offline Karel

  • Super Contributor
  • ***
  • Posts: 2243
  • Country: 00
Re: Goto bad Spooktober tale: Counting goto in the Linux kernel
« Reply #6 on: October 29, 2023, 10:08:20 am »
Based on static analysis defect density, in the 2013 report, we found that open source code outpaced commercial code in quality.
This trend continues in 2014;


Defect density (defects per 1,000 lines of code) of open source code and commercial code has continued to improve since 2013:
When comparing overall defect density numbers between 2013 and 2014, the defect density of both open source code and commercial
code has continued to improve. Open source code defect density improved from 0.66 in 2013 to 0.61 in 2014,
while commercial code defect density improved from 0.77 to 0.76.


Linux continues to be a benchmark for open source quality. By leveraging the Scan service,
Linux has reduced the average time to fix a newly detected defect from 122 days to just 6 days.
Since the original Coverity Scan Report in 2008, scanned versions of Linux have consistently achieved
a defect density of less than 1.0. In 2013, Coverity scanned more than 8.5 million lines of Linux code
and found a defect density of .61



https://news.synopsys.com/2014-04-15-Coverity-Scan-Report-Finds-Open-Source-Software-Quality-Outpaces-Proprietary-Code-for-the-First-Time


https://news.synopsys.com/2015-07-29-Coverity-Scan-Open-Source-Report-Shows-Commercial-Code-Is-More-Compliant-to-Security-Standards-than-Open-Source-Code
 

Offline DiTBho

  • Super Contributor
  • ***
  • Posts: 4039
  • Country: gb
Re: Goto bad Spooktober tale: Counting goto in the Linux kernel
« Reply #7 on: October 29, 2023, 10:14:45 am »
I mysefl seen on IRC a hacker create from scratch all the support for the IP30 platform on his own around the 2.6.17 kernel, then he lost the interest and disappeared from the scene and it took more than 15 years!!! to understand what the hell he had done because his code was not only very cryptic and without any comment, but it was also very low level.

(not only gotos, also asm inlines, strange pointer arithmetic, and really bizarre things, all undocumented  :palm: )

It took us all this time because the IP30 is a very complex platform, there was/is little interest in the platform, and let's get back to the topic... Linux works when it is followed by many people.
The opposite of courage is not cowardice, it is conformity. Even a dead fish can go with the flow
 

Offline magic

  • Super Contributor
  • ***
  • Posts: 6931
  • Country: pl
Re: Goto bad Spooktober tale: Counting goto in the Linux kernel
« Reply #8 on: October 29, 2023, 10:15:36 am »
Article summary:
Quote
[viral clickbait title]

By regularly scanning Linux source code with our proprietary tool, we have reduced the number of bugs that our tool can find. Also, guys got fast fixing bug reports sent by us.

This is totally not an advertisement.
Click here to buy our tool.
« Last Edit: October 29, 2023, 10:22:17 am by magic »
 
The following users thanked this post: audiotubes

Offline DiTBho

  • Super Contributor
  • ***
  • Posts: 4039
  • Country: gb
Re: Goto bad Spooktober tale: Counting goto in the Linux kernel
« Reply #9 on: October 29, 2023, 10:27:08 am »
Linux continues to be a benchmark for open source quality

What I see, and what this is probably about, is the new approach of automatic 'bots operating in parallel on BiSect to find the one which commit introduced the defect, every time we see a regression.

git| git| git| git| git| git| git| git| git| git| git| ... git
compile| compile| compile| compile| compile| compile| compile| compile| compile| compile| compile| ... compile
test| test| test| test| test| test| test| test| test| test| test| ... test|
report| report| report| report| report| report| report| report| report| report| report| ... report|
(a cluster of nodes, doing this, in parallel, each on a commit between point A and point B of the Git history, moving from A to B)

Yes, this helps. But this is not the point, also because the number of regressions is increasing.
Or do you mean that this "instrumental" approach is better?
The opposite of courage is not cowardice, it is conformity. Even a dead fish can go with the flow
 

Offline mikeselectricstuff

  • Super Contributor
  • ***
  • Posts: 13846
  • Country: gb
    • Mike's Electric Stuff
Re: Goto bad Spooktober tale: Counting goto in the Linux kernel
« Reply #10 on: October 29, 2023, 10:36:37 am »
I have no knowledge of Linux' internals & how goto is used, but..
The problem with the philosophical argument that "Goto == bad" is that the real world has error conditions. Dealing with scenarios where errors can occur at any stage in a long and convoluted process while trying to be neat and structured can be a nightmare, and make code far less understandable.
However multiple "If (error) go direcly to here because I don't care what happens after that but I do need to deal with it sanely" is reliable and understandable.

 
« Last Edit: October 29, 2023, 11:09:45 am by mikeselectricstuff »
Youtube channel:Taking wierd stuff apart. Very apart.
Mike's Electric Stuff: High voltage, vintage electronics etc.
Day Job: Mostly LEDs
 
The following users thanked this post: artag, audiotubes

Online Siwastaja

  • Super Contributor
  • ***
  • Posts: 8335
  • Country: fi
Re: Goto bad Spooktober tale: Counting goto in the Linux kernel
« Reply #11 on: October 29, 2023, 11:02:22 am »
I have no knowledge of Linux' internals & how goto is used, but..
The problem with the philosophical argument that "Goto == bad" is that the real work has error conditions. Dealing with scenarios where errors can occur at any stage in a long and convoluted process while trying to be neat and structured can be a nightmare, and make code far less understandable.
However multiple "If (error) go direcly to here because I don't care what happens after that but I do need to deal with it sanely" is reliable and understandable.

A quick example for those who are not familiar with the pattern:

Code: [Select]
int do_thing()
{
    turn_relay_on();
    if(!good_to_go)
    {
        turn_relay_off();
        return FAILURE_1;
    }

    if(asdf != 123)
    {
        turn_relay_off();
        return FAILURE_2;
    }

    do_rest_of_stuff();
    turn_relay_off();
    return SUCCESS;
}

vs.
Code: [Select]
int do_thing()
{
    int rc = FAILURE_TO_DESCRIBE_FAILURE;
    turn_relay_on();
    if(!good_to_go)
    {
        rc = FAILURE_1;
        goto DONE;
    }

    if(asdf != 123)
    {
        rc = FAILURE_2;
        goto DONE;
    }

    do_rest_of_stuff();
    rc = SUCCESS;

    DONE:
    turn_relay_off();
    return rc;
}

In latter case, one cannot accidentally forget to turn relay off when they add another error check. For this simple case, manual bookkeeping of restoring state is possible, but once you have to undo more than one thing in the opposite order, and how far you initialized (and thus, where to begin uninitializing) depends on error condition, gotos are very handy:

Code: [Select]
    init1();
    if(error) goto DEINIT1;
    init2();
    if(error) goto DEINIT2;
    init3();
    if(error) goto DEINIT3;

    DEINIT3: deinit3();
    DEINIT2: deinit2();
    DEINIT1: deinit1();

In C++, one is supposed to use the exception system for the same result. Building something similar on top of C would likely get into territory of overengineering. Goto is simple and clear, and labels are documentative.
 
The following users thanked this post: Karel, abeyer

Offline DiTBho

  • Super Contributor
  • ***
  • Posts: 4039
  • Country: gb
Re: Goto bad Spooktober tale: Counting goto in the Linux kernel
« Reply #12 on: October 29, 2023, 11:04:27 am »
the real work has error conditions. Dealing with scenarios where errors can occur at any stage in a long and convoluted process while trying to be neat and structured can be a nightmare, and make code far less understandable.
However multiple "If (error) go direcly to here because I don't care what happens after that but I do need to deal with it sanely" is reliable and understandable.

Yes, this is the only acceptable use with DO178B level from A to C, but if and only if you don't abuse and if you segregate the modules that use goto into in directory or with a prefix/suffix/whatever that at least makes it clear that it is necessary to analyze how any allocated resources are managed in the event of a jump to the point of failure.

All deallocated? partially deallocated can hide resource leackaging on goto error.
All ignored as the firmware is going to invoke panic() or reboot()?

The VxWorks kernel is a good example here, and you can use goto in this case even for your kernel drivers, if your gotos are properly documented for the attention of both the QA team and the testing squads.

Basically: does the module contain goto? If yes, it must also contain the proper documentation, point by point, as it will be properly inspected and tested. Abuses and neglects will be... punished with "code rejected".

Windriver's approach  :D
The opposite of courage is not cowardice, it is conformity. Even a dead fish can go with the flow
 

Offline Psi

  • Super Contributor
  • ***
  • Posts: 10114
  • Country: nz
Re: Goto bad Spooktober tale: Counting goto in the Linux kernel
« Reply #13 on: October 29, 2023, 11:10:06 am »
This reminds me of that language, what was it, the one that does not have a 'goto' command, and instead has the reverse. a 'come from' command.

That's right, it was C-INTERCAL
Greek letter 'Psi' (not Pounds per Square Inch)
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14925
  • Country: fr
Re: Goto bad Spooktober tale: Counting goto in the Linux kernel
« Reply #14 on: October 30, 2023, 01:23:49 am »
Of course people will keep blabbering about how goto is good while it has been flagged as very bad for decades. Mostly people not actually understanding what is bad about it and why we still use it in C, mostly for error handling, for lack of better constructs. Any other use of it in C *is* generally a very bad idea.

(Quick note: sorry to say that your "egrep -vc 'goto err|goto out|goto fail'" is not really evidence that goto is ever used for anything else than error handling in the Linux kernel code.)

Note that behind this common use case, error handling, the idea is to factor sections of code instead of making them redundant, which is arguably much worse.

There is a well known construct that happens to factor code just fine, and it's called a function. Yes, in many cases you can implement error handling more cleanly writing error handling functions rather than jumping up and down inside a function. With any modern compiler (I mean, younger than 25 years or so), it will even have a very minimal performance impact, if any. Except possibly in very tight loops, for which hand-optimizing further is warranted. You may argue that this approach is not really workable if the error handling part of a given function can have other paths than directly return from said function once the clean-up has been done. In which case, the idea of using goto with not just one code path (error handling/clean-up/return from function) but several is preciselyt what quickly becomes atrocious. The famous spaghetting syndrome.

Now of course, if you resort to a function, that means you'll have to pass some context around, which is not fun. We are lazy.

So with that said, do I still use goto in C on a regular basis for error handling? Yeah. Sure. But I know why I do. I don't do it just because it looks cool to be the programming kiddo that knows better, or to make YT videos with tens/hundreds of thousands of views. And, pointing out that there are other ways to skin the cat, often almost as efficient and much cleaner.

Also, I agree about the fact Linux is not a particularly good example of code style and code quality. But most of it at least looks like C written by people who have a good command of it, so that's already something.
It is, however and IMO, an example of particularly good project management, which is the number 1 reason, again IMO, for its success and longevity.

All in all, that's some kind of false debate that just keeps on going, as again it's used for lack of better constructs in C and similar languages. Not that I take it as an example, but since it's been pretty hyped in the past few years, has anyone heard of using "goto" in Rust? Why keep venting about it?

 

Offline floobydust

  • Super Contributor
  • ***
  • Posts: 7220
  • Country: ca
Re: Goto bad Spooktober tale: Counting goto in the Linux kernel
« Reply #15 on: October 30, 2023, 03:55:10 am »
In a computing science course assignment, used GOTO to bust out of a few nested levels of loops. I think was a Dykstra's shortest path algo.
Asked the prof and he said "no prob" GOTO is sometimes necessary and required, so it exists. So does BRA in assembler.
Like anything it can get abused but I haven't seen that since the days of BASIC, when people did not learn structured programming and could drift towards spaghetti using it. Anybody quickly learns how to code better after getting boxed in, creating a dog's breakfast.

Instead of demonizing necessary programming constructs, what about that old 1970 programming language that still is shit for buffer overruns and array indexes into lala land...
 
The following users thanked this post: audiotubes

Online Siwastaja

  • Super Contributor
  • ***
  • Posts: 8335
  • Country: fi
Re: Goto bad Spooktober tale: Counting goto in the Linux kernel
« Reply #16 on: October 30, 2023, 06:20:03 am »
So with that said, do I still use goto in C on a regular basis for error handling? Yeah. Sure. But I know why I do. I don't do it just because it looks cool

So does this imply you use other constructs, for example for loop, because it looks cool? If not, how does it make any sense to mention that goto is used for... a specific technical purpose, and possibly harmful for others? I mean, isn't that true for nearly every construct in nearly any language?

Same can be asked from DiTBho:

Basically: does the module contain goto? If yes, it must also contain the proper documentation, point by point, as it will be properly inspected and tested. Abuses and neglects will be... punished with "code rejected".

Wat? So if you do not use goto, but instead, for example, create a messed up if-else spaghetti, then there is no need for documentation, no inspections and no tests? Is this what you mean? If yes, I'm horrified. If no, and if documentation, tests and rationale for choices are needed in all cases, what do you mean by the above, it makes no sense to me.

"goto considered harmful" mindset seems to stick hard in some of us, to the point of requiring weird mental acrobatics and "oh I know how to use it, BUT..." type rationalizations. I find it hilarious. It's just one feature of the language amongst others, and specifically C is full of much more dangerous features than that. I mean, integer promotion related bugs is actually a "thing". No one knows a concept of "goto bugs".
« Last Edit: October 30, 2023, 07:48:05 am by Siwastaja »
 
The following users thanked this post: Karel

Offline magic

  • Super Contributor
  • ***
  • Posts: 6931
  • Country: pl
Re: Goto bad Spooktober tale: Counting goto in the Linux kernel
« Reply #17 on: October 30, 2023, 07:17:56 am »
Wat? So if you do not use goto, but instead, for example, create a messed up if-else spaghetti, then there is no need for documentation, no inspections and no tests? Is this what you mean?
This is how government works, so I would expect some of this attitude to leak into government regulated industries too ;)
 
The following users thanked this post: Siwastaja

Online Siwastaja

  • Super Contributor
  • ***
  • Posts: 8335
  • Country: fi
Re: Goto bad Spooktober tale: Counting goto in the Linux kernel
« Reply #18 on: October 30, 2023, 07:52:20 am »
Wat? So if you do not use goto, but instead, for example, create a messed up if-else spaghetti, then there is no need for documentation, no inspections and no tests? Is this what you mean?
This is how government works, so I would expect some of this attitude to leak into government regulated industries too ;)

It never stops amazing me how supposedly safety-critical fields (like aviation) are governed by practices like "using goto is forbidden, now your code passes as it does not use goto" (for example, about half of MISRA actually reduces code quality and increases risk of bugs, while another half might have a slight positive effect which hopefully compensates, for net zero end result). I'm so glad I don't have to work in such setting where using safety-increasing common sense (and known good practices from "standard commercial" software development) on the other hand has to be used so that I could sleep well, but on the other hand is made very difficult to use due to the red tape requiring more dangerous practices, so it's a fine balancing act between the regulations and actual safety.
« Last Edit: October 30, 2023, 01:55:29 pm by Siwastaja »
 
The following users thanked this post: Karel

Offline DiTBho

  • Super Contributor
  • ***
  • Posts: 4039
  • Country: gb
Re: Goto bad Spooktober tale: Counting goto in the Linux kernel
« Reply #19 on: October 30, 2023, 11:39:40 am »
GOTO to bust out of a few nested levels of loops.

oh sht :palm:

The opposite of courage is not cowardice, it is conformity. Even a dead fish can go with the flow
 

Offline DiTBho

  • Super Contributor
  • ***
  • Posts: 4039
  • Country: gb
Re: Goto bad Spooktober tale: Counting goto in the Linux kernel
« Reply #20 on: October 30, 2023, 11:43:28 am »
Wat? So if you do not use goto, but instead, for example, create a messed up if-else spaghetti, then there is no need for documentation, no inspections and no tests? Is this what you mean?
This is how government works, so I would expect some of this attitude to leak into government regulated industries too ;)

It never stops amazing me how supposedly safety-critical fields (like aviation) is governed by practices like "using goto is forbidden, now your code passes as it does not use goto" (for example, about half of MISRA actually reduces code quality and increases risk of bugs, while another half might have a slight positive effect which hopefully compensates, for net zero end result). I'm so glad I don't have to work in such setting where using safety-increasing common sense (and known good practices from "standard commercial" software development) on the other hand has to be used so that I could sleep well, but on the other hand is made very difficult to use due to the red tape requiring more dangerous practices, so it's a fine balancing act between the regulations and actual safety.

yes, why don't you go and play with arduino? Do yourself a favor
The opposite of courage is not cowardice, it is conformity. Even a dead fish can go with the flow
 

Offline DiTBho

  • Super Contributor
  • ***
  • Posts: 4039
  • Country: gb
Re: Goto bad Spooktober tale: Counting goto in the Linux kernel
« Reply #21 on: October 30, 2023, 12:14:20 pm »
Wat? So if you do not use goto, but instead, for example, create a messed up if-else spaghetti
then there is no need for documentation, no inspections and no tests?

cognitive problems?

Nobody said that! It's always under DO178B, therefore normal procedures are applied; I only underlined that is Windriver's approach to add an extra layer as the modules containing "goto" must be reported for further inspections, and there must be documented, otherwise the code won't pass.

edit: to be more clear. necessary condition, not sufficient!

This does not mean that there will not be the normal testreport vectors, on the contrary, it means that the testing team will have the opportunity to better understand how to test the various error cases, a typical situation in which gotos are used.

It also means that this type of test report cannot be assisted by A.I., as the comments are written in human language.

So, this approach also helps plan activities.

Note, that's very different from trying to ridicule what I wrote, as I said "goto" is accepted, and explained when it's accepted, and how it is managed.

I'm horrified

Perplexed. Like giving pearls to pigs.
« Last Edit: October 30, 2023, 05:00:00 pm by DiTBho »
The opposite of courage is not cowardice, it is conformity. Even a dead fish can go with the flow
 

Online Siwastaja

  • Super Contributor
  • ***
  • Posts: 8335
  • Country: fi
Re: Goto bad Spooktober tale: Counting goto in the Linux kernel
« Reply #22 on: October 30, 2023, 12:48:50 pm »
Nobody said that! It's always under DO178B, therefore normal procedures are applied; I only underlined that is Windriver's approach to add an extra layer as the modules containing "goto" must be reported for further inspections, and there must be documentation, otherwise the code won't pass.
Sounds like typical regulatory BS, the usual mischief that if you do X then you get extra chores so that practically you won't be doing X, even when doing X would be the best option, and then you do bullshit like add weird and complex temporary variables and their conditions in the loop termination definition just to avoid goto (and maybe break, too) and the related extra chores.

Maybe I'm too simple-minded, but I think best would be that all safety-critical code must go through the same level of scrutiny with the goal of proving the correctness as far as humanly possible. I fail to see what is so special in goto that it requires a complete separate extra process.

Quote
It also means that this type of test report cannot be assisted by A.I., as the comments are written in human language.

Quite sadly, ChatGPT is well capable of generating human language reasoning which sounds very convincing to managers. Probably the only way is to know your staff and only hire responsible, competent people who are proud of what they are doing. Having a system where usage of "goto" triggers another layer of red tape drives the culture to the opposite direction.

yes, why don't you go and play with arduino? Do yourself a favor

"go play with Arduino" - embedded engineers' way of saying "fuck you". I hear you :-DD

Quite typical - I'm discussing my concerns regarding safety regulations and their effectiveness, and what I get is an ad hominem attack. Fair enough, but don't forget - reality is on my side - arrogance and safety DON'T PLAY ALONG, this is the key finding during aircraft accident investigations in 1970's and 1980's that triggered design of cockpit resource management. We need similar thought patterns (allowing questions and disagreements, reasoning instead of name-calling) in safety critical engineering*, instead of calling those who disagree to fuck off.

*) which I have done, just on a field that was so new that it didn't have regulatory standardization at the time (and still probably does not) so went under much more generic set of regulations, prompting for own thinking.
 
The following users thanked this post: Karel, audiotubes

Offline DiTBho

  • Super Contributor
  • ***
  • Posts: 4039
  • Country: gb
Re: Goto bad Spooktober tale: Counting goto in the Linux kernel
« Reply #23 on: October 30, 2023, 01:35:09 pm »
"go play with Arduino" - embedded engineers' way of saying "fuck you". I hear you :-DD

If we have to be assholes, then what are your skills? last time you said that you deal with "home automation", yet up here you deliberately allowed yourself to distort what I wrote in order to insult, once again, an entire category of workers.

Quite sadly, ChatGPT is well capable of generating human language reasoning which sounds very convincing to managers. Probably the only way is to know your staff and only hire responsible, competent people who are proud of what they are doing. Having a system where usage of "goto" triggers another layer of red tape drives the culture to the opposite direction.

Oh SHT, again  :palm:

Do you even have the qualifications to shit in our shoes? ChatGPT is well capable ... I do not think so, and I don't even care, I'd sooner ignore you than waste any more time.

Quite typical - I'm discussing my concerns regarding safety regulations and their effectiveness

Ok, Quite typical, enjoy my ignore list, this time is permanent.
The opposite of courage is not cowardice, it is conformity. Even a dead fish can go with the flow
 

Online Siwastaja

  • Super Contributor
  • ***
  • Posts: 8335
  • Country: fi
Re: Goto bad Spooktober tale: Counting goto in the Linux kernel
« Reply #24 on: October 30, 2023, 01:51:35 pm »
Interesting how emotional some people can get over a simple language feature  :popcorn:

In any case, I don't recall insulting any workers, and despite re-reading my posts a few times, can't find anything that even remotely resembles that. Maybe some mental mixup between threads or something?

edit: oh shit, he meant I insulted the regulators. Being an engineering forum where we are usually not the ones to write the regulations, but to obey them, that perspective didn't pop to my mind, but maybe I was a bit harsh for those who make the rules. After all, rules are like words of God; they can't be disagreed with.
« Last Edit: October 30, 2023, 01:59:31 pm by Siwastaja »
 

Offline magic

  • Super Contributor
  • ***
  • Posts: 6931
  • Country: pl
Re: Goto bad Spooktober tale: Counting goto in the Linux kernel
« Reply #25 on: October 30, 2023, 03:37:41 pm »
This guy always sounds like somebody bringing home wheelbarrows of gold thanks to his advanced knowledge of safety critical software development on obsolete hardware ;)

Very happy with his job, no doubt.
 

Online Siwastaja

  • Super Contributor
  • ***
  • Posts: 8335
  • Country: fi
Re: Goto bad Spooktober tale: Counting goto in the Linux kernel
« Reply #26 on: October 30, 2023, 04:03:36 pm »
I have absolutely nothing against him, although many of his ideas I find pretty weird, but weird in a good way; I don't prefer to sit in an echo chamber. I also disagree with some ideas such as hiding pointer-ness behind a type and naming convention instead of using language built-in syntax to convey that information, but ultimately such things are also matter of taste, and if he finds hiding pointerness and not using gotos help him writing safer code, what can I say? It doesn't work for me but probably works for others. I don't understand the personal attack on projects. Me working on building automation systems doesn't mean I'm not allowed to even discuss safety critical software any more than himself having worked on embroidery machine control project.
« Last Edit: October 30, 2023, 04:07:11 pm by Siwastaja »
 

Offline Nominal Animal

  • Super Contributor
  • ***
  • Posts: 6548
  • Country: fi
    • My home page and email address
Re: Goto bad Spooktober tale: Counting goto in the Linux kernel
« Reply #27 on: October 30, 2023, 05:48:31 pm »
Pointing out that the Linux kernel uses goto is like pointing at someone using a leg prosthesis, and shouting Ha ha! Look at that stupid peg leg!



Me, I don't trust standards and regulations, not even ISO or POSIX C or MISRA-C or DO-178B.  I highly appreciate the principles and the reasoning behind them, and try to abide by those –– especially security, robustness, reliability, and maintainability –– depending on my needs, but practice trumps theory.  Always.

Arguments like this one, especially when they get personal, make me go :o :-//.

Some of you argue based on DO-178B, the others do freestanding/hosted development under review-based quality control.  They're not the same environment!
Define your own context, basis of argument and environment, before getting caught up in the argument.  Yes, it leads to over-long posts like mine, but at least then you have a chance of arguing about the same thing, instead of a similar thing in wildly different contexts.  Apples and pineapples.

One related case that I recently thought about is the fact that in ISO C, binary right shift of negative values is implementation defined.  This means that a particular C compiler could choose to "optimize" code by having any right shift of a negative value do nothing.  If anyone complains, they can simply point to the standard and point out – correctly – that they're fully compliant already.
Me, I am only interested in compilers that generate an arithmetic right shift on negative two's complement integers, i.e. (-29) >> 1 == -15.  Generating anything else is just silly and anti-useful on the architectures I use, from 8-bit AVRs to 64-bit AMD64/x86-64 and ARM64.
Thus, my code is not strictly portable in the ISO C standard sense.  Yet, in practice, my code tends to be quite portable, with just a set of notes and restrictions one can test.

This means that if anyone asks me if >> on an intN_t or int_fastN_t-type expression is safe in C, my answer depends on the context (but I often assume one, rightly or wrongly, based on the names/labels the asker used).  Or I explain the standard stance and my attitude towards it.
Similarly, I need to see a particular case of goto use (including the project context), to even have an opinion about it.

To have an opinion about goto use in the Linux kernel, without showing superior C constructs that yield the same or better machine code on all architectures, is just shouting "Ha-ha!".  Not useful, not informative; just juvenile.
 
The following users thanked this post: Karel

Offline DiTBho

  • Super Contributor
  • ***
  • Posts: 4039
  • Country: gb
Re: Goto bad Spooktober tale: Counting goto in the Linux kernel
« Reply #28 on: October 30, 2023, 06:39:00 pm »
This guy always sounds like somebody bringing home wheelbarrows of gold thanks to his advanced knowledge of safety critical software development on obsolete hardware ;)

This is another one of those things that annoys me, but note that almost none of my colleagues ever talk about what they do for work, each of us has spent ~50K euro and 10 years on training, in open source you don't find any of this, and yet, instead of appreciating, you do nothing but making fun of my category, when the concept that "we would be" trained "monkeys" who "follow orders" is even conveyed.

Sorry, I really don't think I will ever say anything else in this forum.


The opposite of courage is not cowardice, it is conformity. Even a dead fish can go with the flow
 

Online ejeffrey

  • Super Contributor
  • ***
  • Posts: 3800
  • Country: us
Re: Goto bad Spooktober tale: Counting goto in the Linux kernel
« Reply #29 on: October 30, 2023, 07:05:17 pm »
Basically goto is like the C preprocessor.  It's a low level construct that can be very powerful, but also can cause a lot of problems.

I don't think it's quite fair to say "they can be abused just like any other language construct" I think fundamentally both of them should be considered as dangerous to use and best to be avoided, but there are a lot of particular use cases that cover shortcomings of the language that are better implemented with those features that without.  If I were to design a C/C++ like language, I would be happy to include both, but would strive to make sure that the core language covered as many known use cases as possible so that nobody wanted or needed to use them.

Error handling is the most common case in C where goto is often really the best solution.  But C++ has RAII which generally covers most if not all of those cases.  As a bonus, it can do so more efficiently -- goto error approaches often require tests for each possible resource to be cleaned up since you don't know where you jumped in from, while RAII automatically invokes exactly the required cleanup handlers.  Usually a trivial difference, but might make sense in some situations.

Exiting a nested for loop is another common use of goto.  It's a bit more controversial since there is an often superior alternative which is to factor the loop into a function and use return, but it's still a core feature that C doesn't have: targeted break/continue. 

If C had clean support for registering function level cleanup expressions and targeted break/continue, probably 99% of uses of goto would go away.  And that doesn't mean the other 1% are bad uses, but there would be a lot fewer to consider on a 1-off basis.

The preprocessor is the same way.  Very old compilers didn't support inlining well, so macros were used for optimization, even though it had problems with parse confusion and side effects.  Now compilers are good at inlining and that use is now pretty much obsolete.  C doesn't support polymorphic functions, so macros can be (carefully) used for that purpose -- although C11 introduced generic functions that are better to use when they work.  C doesn't allow even constant variables to be used for initialization, so preprocessor macros have to be used for that.  The list goes on.  Even "standard use case" is something that should be considered for making a dedicated language feature. 

So people categorically labeling these structures as bad without caveat ignores the fact that they are being used as real solutions for shortcomings of the language.  Suggestions they be replaced with more complex code to achieve some abstract purity are not helpful.

And of course, the cure isn't always better than the disease.  C++ templates let you do a lot of powerful generic programming that would otherwise be done by the preprocessor, and do so in a type safe manner, but abuse of the template system can be as bad as the preprocessor macros it replaces.
 
The following users thanked this post: newbrain

Offline DiTBho

  • Super Contributor
  • ***
  • Posts: 4039
  • Country: gb
Re: Goto bad Spooktober tale: Counting goto in the Linux kernel
« Reply #30 on: October 30, 2023, 07:41:57 pm »
but practice trumps theory.  Alway

That's precisely why I mentioned the Windriver's approach!

It's not that I was describing something on a theoretical level, I made precisely the practical discussion, because someone cited the linux kernel to argue that "gotos are fine", and I pointed out that it would be better to look at WxWorks, simply because if there is no documentation on linux (and frankly I often struggle to understand what exactly the code does in case of error propagation), everything is documented on WxWorks!

I then mentioned DO178B to underline that the Windriver's approach is a kind of simplified subset, which is good even when you are part of a small team and you have to deal with a lot of work(1) to do and with many things to verify. Thanks to Windriver, you have a simplified rule-set where "goto" are allowed for error-handling and have documentation (mandatory), which help to understand how to manage the test-reports!

Again, it's not something on a personal level, otherwise I would have told you that in my-c language *any goto* is always forbidden, and here I would have started to mention how I have already solved the whole "goto thing" on both theoretical and experimental levels.


(1) which is mandatorily required by the life cycle watertight compartmentalization procedures described by these regulations.
The opposite of courage is not cowardice, it is conformity. Even a dead fish can go with the flow
 

Offline Nominal Animal

  • Super Contributor
  • ***
  • Posts: 6548
  • Country: fi
    • My home page and email address
Re: Goto bad Spooktober tale: Counting goto in the Linux kernel
« Reply #31 on: October 30, 2023, 09:33:39 pm »
It's not that I was describing something on a theoretical level, I made precisely the practical discussion, because someone cited the linux kernel to argue that "gotos are fine", and I pointed out that it would be better to look at WxWorks, simply because if there is no documentation on linux (and frankly I often struggle to understand what exactly the code does in case of error propagation), everything is documented on WxWorks!
No, actually you didn't.  Reread your first two posts, reply #2 and reply #3.  You'll understand how the discussion derailed.  Reply #3 was, intended or not, just yelling "Ha-ha! Look at that peg leg!"

If you had instead constructed a reply along the lines you intended, say
Quote
The error propagation patterns where goto is used in Linux are not well documented, or specified in any style or design guide I can find, and I do have difficulty unraveling them.  Thus, I don't think that goto are fine just because they're used in the Linux kernel, at all.

In my opinion, it would be much better to look at e.g. WindRiver WxWorks sources and documentation for error propagation patterns: they do it right.
and then maybe add a bit about your experiences/opinion working on both, and what this means when one gets paid to work under MISRA-C or DO-178B rules, the thread would have continued very, very differently.

I know that's very much along the lines of what you intended (we've discussed similar details and Linux kernel wonkiness elsewhere); it just came out wrong.  All this mess is just a communications issue, worth fixing, but not something to get irritated over.

I like you and Siwastaja both; I sometimes agree, sometimes disagree with both of you.  I like to argue with you both (and SiliconWizard and RoGeorge and others; I like you too!), as we keep it to things and don't usually let it go personal.  When it does, it needs to be fixed, because otherwise many useful and interesting future arguments will be lost, not-had at all.

In this particular case, I chose to step in (and in this way), because I know you know I myself struggle a LOT with communication, and we've discussed elsewhere about the approaches that work better, and our own typical failure patterns.  Simply put, I can see myself doing exactly the same error here, and I'd like the error to be fixed, so we can go back to arguing about the interesting stuff instead.  Tough love, if you like.

Perhaps I should have done this via PM instead, but didn't because DiTBho didn't start the thread, and my :o :-// was more directed at RoGeorge for starting the thread in the first place and everyone else equally for arguing, well, about the statistics of goto use!
Thus, I suppose I too failed in my communication attempt here.  I apologise.  :-[
 
The following users thanked this post: Siwastaja, JPortici, gerber

Online nctnico

  • Super Contributor
  • ***
  • Posts: 27405
  • Country: nl
    • NCT Developments
Re: Goto bad Spooktober tale: Counting goto in the Linux kernel
« Reply #32 on: October 31, 2023, 12:31:03 am »
goto is a normal part of C and trying to avoid using it for political reasons leads to less readable spaghetti code.
You can just as easely argue using goto leads to unreadable code due to jumping to other parts of a function which makes it hard to follow a function (and where it actually exits). But the same can be argued about using return somewhere in the middle of a function and break and continue in for/while loops. I'd say using a goto is typically an indication of problems getting the code structured in a way that the code is easy to follow.

In the Linux kernel using goto is typically done for an on-exception-exit pattern. Most of the drivers use gotos in their init section where depending on how far the process gets, dynamically allocated memory gets unallocated in case the driver initialisation fails. IMHO this is one of the very few good uses of goto in the C language: crude exceptions.
« Last Edit: October 31, 2023, 12:35:58 am by nctnico »
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 
The following users thanked this post: MK14, SiliconWizard

Online Siwastaja

  • Super Contributor
  • ***
  • Posts: 8335
  • Country: fi
Re: Goto bad Spooktober tale: Counting goto in the Linux kernel
« Reply #33 on: October 31, 2023, 07:32:55 am »
You can just as easely argue using goto leads to unreadable code due to jumping to other parts of a function which makes it hard to follow a function

Quite obviously, but I chose not to reiterate that viewpoint because it seems to be very very very commonly known and discussed already. (The very reason why people do stuff like grep goto on linux kernel.)

The two typical uses for goto in C are as you mention exception handling during initializations, which I demonstrated above with code, and in some cases, for breaking out of a 2D loop without having to resort to unintuitive temporary variables.

And no, 2D loops are not evil per se. For example, if you process a 2D image then x and y loops make perfect sense and it would be confusing to refactor into a function call (loop_row() or what?) just to get rid of one level. And C doesn't have named loops and break only breaks one level, so goto fixes both: it adds labels and allows breaking two levels.

Now one could argue that most if nearly all good uses of goto always jump forward, but I'm sure someone can come up with a good example where jumping backwards is better than the alternatives, but this would be a rarity. Personally I have done that when handling exceptional error cases where I just want to "start over" instead of "giving up", as a quick fix for the edge case instead of spending a lot of time figuring out how to refactor the whole thing so that this edge case handles "more elegantly".

We were taught in university how goto is bad because you can jump anywhere, including other functions but that obviously was a lie and tells a lot about the level of understanding in the academic world.
« Last Edit: October 31, 2023, 07:43:06 am by Siwastaja »
 

Online nctnico

  • Super Contributor
  • ***
  • Posts: 27405
  • Country: nl
    • NCT Developments
Re: Goto bad Spooktober tale: Counting goto in the Linux kernel
« Reply #34 on: November 01, 2023, 12:55:27 am »
I wouldn't call it a lie but rather an over-simplified model. I'm from the period when universities started teaching Pascal in order to make students think about structuring their software in an elegant way. Quite usefull until the point some people start to have the crazy idea you can write real software in Pascal  8)
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Offline DC1MC

  • Super Contributor
  • ***
  • Posts: 1882
  • Country: de
Re: Goto bad Spooktober tale: Counting goto in the Linux kernel
« Reply #35 on: November 01, 2023, 07:26:34 am »
...
We were taught in university how goto is bad because you can jump anywhere, including other functions but that obviously was a lie and tells a lot about the level of understanding in the academic world.

Why no one is discussing animore about  setjmp and longjmp in C  :-DD

Cheers,
DC1MC
 
The following users thanked this post: Siwastaja

Offline DiTBho

  • Super Contributor
  • ***
  • Posts: 4039
  • Country: gb
Re: Goto bad Spooktober tale: Counting goto in the Linux kernel
« Reply #36 on: November 01, 2023, 09:17:11 am »
You'll understand how the discussion derailed.  Reply #3 was, intended or not, just yelling "Ha-ha! Look at that peg leg!"

Can you see how frustrating this forum is?

I said in order
  • Linux is not a good reference. Is it? you confirmed it's not
  • then I mentioned PPC because it's what I am working at the moment and it's happening right now that we have 5 months of regression, Linus himself is complaining
  • so, Linux is not a good reference, not even for looking at how gotos are used
  • at that point someone suggested that a big problem is documentation, and I confirmed it
  • little anecdote about how the "cowboy to the console" approach to the wild west of Linux, can even create absurd situations where if nobody understands absolutely nothing about the code then it's a big problem for development. It was full of gotos, in many point it was abused, strange pointer arithmetic, inline assembly and all kinds of shenanigans, and to understand how the code worked, thousands of hours of work were needed, practically rewriting everything from scratch
  • then I pointed out that if there are no precise regulations you end up having little projects that only stand up if there are a lot of people following them, just like Linux, or worse still, just like linux in my anecdote
  • at that point I suggested looking elsewhere, pointing out that where there are regulations, things are much better both understandable and manageable, even by small teams
  • I mentioned VxWorks, and the discussion derailed *HERE* when I pointed out Windiriver's approach, and note why it derailed: because some "troll" willfully misunderstood what I wrote in order to ridicule those who do competent work

And frankly it bothers me a lot that people who don't even have the competence to speak (for example about DO178, someone here called it "bullshit for trained monkeys"), and this is because they have never done anything mission critical, often allow themselves to start a reply with the "it's bullshit", as happened in the topic of cyclomatic complexity.

Even worse when what they call "bullshit" often has serious reasons behind it, sometimes reasons of an organizational and not just technical nature.

And this because "practice" means "organize people doing software" as important as "design software" as well as "find a resonable way to allocate resources to test software".

All points that have continued to be repeated for years, and you explain it and every damn time we always come back to the same points, over and over, which makes me realize that arguing in this forum is a total waste of my time.


So, sorry, but no.
The opposite of courage is not cowardice, it is conformity. Even a dead fish can go with the flow
 

Online Siwastaja

  • Super Contributor
  • ***
  • Posts: 8335
  • Country: fi
Re: Goto bad Spooktober tale: Counting goto in the Linux kernel
« Reply #37 on: November 01, 2023, 11:48:52 am »
Or, maybe you just take someone calling a practice "bullshit" (A) personally, (B) too seriously? I mean, it's not that strong of a word. It just means whoever said that does not believe the practice is good at all. More important is to look why they think the practice is bullshit. And don't get hurt on behalf of a process.

I don't remember seeing that "trained monkey" thing you refer to, and it's nasty language I admit that. I have never ever name-called professionals working on the regulated fields you mention, and have no reason to do that. If you read what I wrote, you will see it's the opposite; I'm happy I can create software more freely and still sleep well, not being on their shoes; and I'm happy I can still discuss what I think about safety critical software, but it seems you are not happy about me discussing it.

But whatever. I think your fundamental issue on this forum is in anger management and poor communication. You are not the only one, I can say from personal experience of having the exact same issue. But in reality, others are not as stupid as you may think. Give us a chance.
« Last Edit: November 01, 2023, 11:50:36 am by Siwastaja »
 

Offline DiTBho

  • Super Contributor
  • ***
  • Posts: 4039
  • Country: gb
Re: Goto bad Spooktober tale: Counting goto in the Linux kernel
« Reply #38 on: November 01, 2023, 07:31:33 pm »
But in reality, others are not as stupid as you may think. Give us a chance.

... well, about that, it's you who that, misunderstanding what I wrote, thought that we must be really *very stupid to accept*(1) - according to your interpretation -  that it is enough to make Chatgpt(1) write some random documentation in the code to pass a piece of code by the QA team, who is composed by professionists!

I didn't specify what it was "necessary condition, not sufficient", my fault there, I edited my post, but how many times have I repeated how things really work? How many? So, before starting with "I'm horrified", didn't you even have any doubts? no, because in your opinion we only do bullshit! It takes you very little to brand things as "bullshit" (like in the Cyclomatic topic, where I simply ignored some of your bad statements), and it costs me too much time to explain it to you, and then what? See, you didn't even get the concept!

Damn, this is the common pattern here in this forum(2), and it's really frustrating!

Among other things, if I have always underlined that developers and testers should never talk to each other except through specific documents, the Windriver's approach creates a shortcut that allows, through mandatory documentation, to better describe both the code and the various doubts about how to write and test it, which is brilliant "extension" because it reduces the numer of iteractions and helps people growing up "team building"!

It seems like something within everyone's reach, because everyone can start describing the code, obviously in a concise and targeted way; Windriver pays some professionists with skills in being concise and targeted way, and QA guys have the same skill, so here OpenSource guys have to learn to do it well, but it's a true benefit and it's feasible, if not mandatory, it should at least become a habit!


(1) precisely here I saw the offense to the entire category
« Last Edit: November 01, 2023, 07:33:17 pm by DiTBho »
The opposite of courage is not cowardice, it is conformity. Even a dead fish can go with the flow
 

Online Siwastaja

  • Super Contributor
  • ***
  • Posts: 8335
  • Country: fi
Re: Goto bad Spooktober tale: Counting goto in the Linux kernel
« Reply #39 on: November 01, 2023, 07:56:44 pm »
I merely commented on your claim that AI cannot be used to cheat "because it's in natural language". Don't take it out of context. I totally agree with what you now write; that competency in management is what prevents such cheating. You(!!) are the one who mentioned cheating with AI, as if it would happen if the document were not in natural language! You were the one whose descriptions about these regulated fields made me horrified. You are the one giving bad picture about "your" field. You fail to communicate because you are arrogant and write quicker than you think when angry.

And while I trust a lot of safety critical software (otherwise, I would not board an airplane), I still have my doubts about how the arrogance you show affects your work.

Now can you do us all a favor and start actually ignoring people you claim to ignore and therefore stop derailing threads? Thank you in advance.
« Last Edit: November 01, 2023, 08:00:13 pm by Siwastaja »
 

Offline thm_w

  • Super Contributor
  • ***
  • Posts: 6729
  • Country: ca
  • Non-expert
Re: Goto bad Spooktober tale: Counting goto in the Linux kernel
« Reply #40 on: November 01, 2023, 10:31:16 pm »
Code: [Select]
int do_thing()
{
    turn_relay_on();
    if(!good_to_go)
    {
        turn_relay_off();
        return FAILURE_1;
    }

    if(asdf != 123)
    {
        turn_relay_off();
        return FAILURE_2;
    }

    do_rest_of_stuff();
    turn_relay_off();
    return SUCCESS;
}

You can write it this way instead:

Code: [Select]
int do_thing()
{
    turn_relay_on();
    if(!good_to_go)
        result = FAILURE_1;

    else if(asdf != 123)
        result = FAILURE_2;

   else
    {
    do_rest_of_stuff();
    result = SUCCESS;
    }

    turn_relay_off();
    return result;

Anything that relies on copy pasting required steps in multiple locations is generally bad code. Regardless of having goto's or not.
Profile -> Modify profile -> Look and Layout ->  Don't show users' signatures
 

Offline cfbsoftware

  • Regular Contributor
  • *
  • Posts: 120
  • Country: au
    • Astrobe: Oberon IDE for Cortex-M and FPGA Development
Re: Goto bad Spooktober tale: Counting goto in the Linux kernel
« Reply #41 on: November 01, 2023, 11:39:05 pm »
Damn, this is the common pattern here in this forum(2), and it's really frustrating!
I believe it would help let off steam in this forum if we could just mark a message as "Say No Thanks" instead of "Say Thanks" and then move on.
« Last Edit: November 01, 2023, 11:40:39 pm by cfbsoftware »
Chris Burrows
CFB Software
https://www.astrobe.com
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14925
  • Country: fr
Re: Goto bad Spooktober tale: Counting goto in the Linux kernel
« Reply #42 on: November 02, 2023, 05:46:24 am »
Damn, this is the common pattern here in this forum(2), and it's really frustrating!
I believe it would help let off steam in this forum if we could just mark a message as "Say No Thanks" instead of "Say Thanks" and then move on.

That's not a bad idea indeed.
 
The following users thanked this post: cfbsoftware

Online Siwastaja

  • Super Contributor
  • ***
  • Posts: 8335
  • Country: fi
Re: Goto bad Spooktober tale: Counting goto in the Linux kernel
« Reply #43 on: November 02, 2023, 11:21:27 am »
That idea has been discussed before and while on surface it looks like a good idea, it quickly becomes stack overflow / reddit type "downvote into oblivion" system. "Thank you" thing might be unnecessary, but at least it's mostly positive (even that is used in a nasty way, "thanking" some users from very low-quality contributions just because they disagreed with someone with "wrong" opinion, but that use pattern is at least complex and thus not too common, compared to direct downvoting).

Users already have a way "to move on". Everyone posts here at their free will. Being able to be negative against people in a yet another (and easier!) way only results in more negativity, not "moving on".
« Last Edit: November 02, 2023, 11:41:56 am by Siwastaja »
 
The following users thanked this post: newbrain

Offline metertech58761

  • Regular Contributor
  • *
  • Posts: 156
  • Country: us
Re: Goto bad Spooktober tale: Counting goto in the Linux kernel
« Reply #44 on: November 20, 2023, 02:30:51 pm »
When I started learning C++, I too was told "GOTO bad. VERY BAD. Here your dunce cap. Stand in corner!"

After stewing on that a while, I came up with a different take; I write the code as I please, then go back and say "How many GOTO can I take out and still understand what's going on?"
 

Offline Karel

  • Super Contributor
  • ***
  • Posts: 2243
  • Country: 00
Re: Goto bad Spooktober tale: Counting goto in the Linux kernel
« Reply #45 on: November 20, 2023, 04:02:52 pm »
In the poll, I'm missing the option: Linus and his lieutenants know what they are doing
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf