>everyone says you should never use goto because its harmful
>the linux kernel uses it
so what is it ganooniggas,either the linux kernel has shitty code or goto is not bad.
>everyone says you should never use goto because its harmful
>the linux kernel uses it
so what is it ganooniggas,either the linux kernel has shitty code or goto is not bad.
Goto isn't bad if you aren't a retard, it gets compiled to conditional jumps anyways
its not even used rarely.the kernel code is littered with them.
>>everyone says you should never use goto because its harmful
>never
That's like saying you should never use powertools because you might cut your fingers off. If you know how to use them you will be fine.
the magnum opus of readable code.
Saved you the trouble of having to ctrl+f every single occurrence through your GUI :^)
grep -ro goto | wc -l
150871
what is it lincucks?when its time to slender windows you are like rabid dogs.nothing to say about your precious linux?
>dont use std because it had a bug back in 2001
>dont use boost because it had a bug in 2008
>dont use goto because these blogs say so from 2005
>dont use while because a post on Jow Forums says so
>dont use if because a post on Jow Forums said it was bad
Women in coding was a mistake.
Linux uses gotos for exception handling, which is a completely legitimate use case.
Goto is harmful when you use it instead of control structures like if, for, etc.
No one does that any more anyway - The Dijkstra article is horribly outdated.
>everyone says you should never use goto because its harmful
Nobody actually thinks that, it's just a meme.
It's not so much that goto is bad, only that it has very few legitimate use cases. There are two areas where you should use a goto:
1. Escaping a nested loop.
2. Error handling to avoid writing the same cleanup code over and over again.
The Linux kernel has the second use case come up quite a bit. If you aren't using it for these use cases though, you have no legitimate excuse to use goto over other constructs.
Of course, if you're using C++, the second use case becomes worthless because you can just use RAII and/or actual exceptions.
Paneet, see and Also, isn't it WAY past your bedtime?
>everyone says you should never use goto because its harmful
>ctrl+f spaghetti
>0 results
Jow Forums is not even able to explain why it's harmful in a simple way
btw, see this nice example
imperialviolet.org
how is it readable? its a clusterfuck and complete opposite.
That has absolutely nothing to do with the problems of goto. This is actually a legitimate use of goto.
That bug is at best an argument for forcing braces on one-line ifs.
apart from having an issue of reading code, you obviously have an issue of understanding sarcasm too
The expression “the Linux kernel” can easily be misunderstood as meaning “the kernel of Linux” and implying that Linux must be more than a kernel. You can avoid the possibility of this misunderstanding by saying or writing “the kernel, Linux” or “Linux, the kernel”.
>That bug is at best an argument for forcing braces on one-line ifs.
you are right
>linux kernel has shitty code
It literally does. Anyone that's actually bothered to look into literally any other unix OS out there has known this forever. OpenBSD and Illumos are some of the most well written "mainstream" OS codebases out there, while more obscure projects like HelenOS and SeL4 have even better code. Then there's projects like Minix and xv6 which were designed to have good clear code from the getgo, because they wanted to actually be educational, and not have autistic spaghetti code just for the hell of it.
Just like with everything else in life, popularity doesn't automatically make something better. And anybody defending Linux/Linus like some infallible sacred cow is an idiot. That being said, GOTOs aren't always terrible either, and it depends on the situation. But most of the time it's just used as a lazy "optimization" to avoid having to refactor the mess that required you to use it in the first place.
I love Illumos, but meltdown has been a total clusterfuck for unpopular OSes and I'm be concerned about production use in the future.
bet you fags don't even know what the unlikely function does.
No, it gets compiled to a jump.
this is actually pretty readable. does it take some domain knowledge? of course, but it's pretty transparent.
Actually when the Win2k bits of source code leaked it was noted how well it was written. Linux is just for NEETS and neckbeards
>OpenBSD and Illumos are some of the most well written "mainstream" OS codebases out there
theinquirer.net
>dumb tripfag shilling for proprietary garbage
how original