Comments by "Anony Mousse" (@anon_y_mousse) on "Low Level"
channel.
-
2200
-
102
-
65
-
63
-
59
-
41
-
40
-
32
-
30
-
29
-
29
-
23
-
17
-
15
-
14
-
14
-
14
-
13
-
11
-
11
-
11
-
11
-
To clarify, it's not that C, or for that matter C++, are unsafe languages, rather that too many programmers are unsafe. Rust doesn't actually provide a guarantee about safety, regardless of what its proponents will say, but it makes it slightly more difficult to do certain unsafe things by mistake. However, if you have to use an unsafe keyword, already a design mistake there, then you're going to be without certain protections. If you have to abstract around the use of the unsafe keyword it separates your code in an unnatural way that will make it harder to debug. So either you overuse the unsafe keyword and constructs that go with it, or you abstract. Neither is good, especially at kernel level. What we really need is better programmers who actually understand the underlying hardware and can write safe code. The most prevalent errors that programmers make are ones that are super easy to prevent, regardless of language. At least if you're not a dingus.
11
-
11
-
11
-
10
-
9
-
9
-
9
-
9
-
8
-
8
-
8
-
8
-
7
-
7
-
7
-
7
-
7
-
7
-
Rust won't prevent all errors and triggers errors on code that would otherwise work 100% perfectly fine. It's training wheels for newbies, but no one who wants the language to get out of the way so they can do real work should use it. If you write your code in a way similar to how Rust wants you to write your code then literally any language would work equally as "safely", except that most others will let you get on with the task of actually writing the code. If you have to integrate with anything closed source, and I know Rust hates closed source, but you introduce a possible security hole and if you're writing real code you're going to use someone else's libraries instead of implementing everything from scratch yourself. If you want to write code that's safe, using a library written in an older language, and which has been debugged for decades, will give you the best path to success. Also, from a purely aesthetic point of view, Rust is uglier than C++, and from a usability point of view it's far, far slower to compile which makes iterative design harder to do.
7
-
6
-
6
-
6
-
6
-
6
-
6
-
6
-
6
-
6
-
5
-
5
-
5
-
5
-
5
-
5
-
5
-
5
-
5
-
5
-
5
-
5
-
5
-
This is one of those few things that Pascal actually did better than C. In fact I opted to copy that for my own language, := to assign, = to compare shallow, and == to compare deep. Well, copy and amend. As it turns out, I do assign variables at times in condition headers, and it would be quite annoying to give up that ability or make it a warning/error. The solutions that people come up with often make no sense. Like in Java, "gee, using goto is problematic if you don't know what you're doing", "we'll just delete it from the language and it'll be fine." Turns out that sometimes your code looks worse without it and is even more spaghetti-fied. The same could be said for Yoda notation which wouldn't catch if ( a = b ) errors, if it's not intentional.
5
-
5
-
4
-
4
-
4
-
4
-
4
-
4
-
4
-
4
-
4
-
4
-
4
-
4
-
4
-
4
-
4
-
4
-
4
-
4
-
3
-
3
-
3
-
3
-
3
-
3
-
3
-
3
-
3
-
3
-
I hope you read this, but it is a skill issue because we've had static analyzers of all varieties for use with C and C++ for decades. Not using one to validate your code if it's going to be in a critical, as in life or death, device, that's a skill issue. Something to consider is that there are millions of fresh graduates out there who have no clue what they're doing and often get tasked with writing code, whether it be on the job training or just as an exercise in testing their skills, and without any critical thinking and proper analysis of what they've written, that code gets used in products that ship.
We've known how to write safe and secure code for decades, and yet people still write bad code because they are unskilled. Also, the 70% number you keep quoting was from a non-representative survey and should be ignored as a false data point. And in case you would like to point out that senior devs make mistakes and want to claim that the Rust compiler can somehow do what a more feature-filled decades old static analyzer can do, consider that maybe they shouldn't be called senior devs if they're not going to make use of the free and open source tools to properly check their C code, especially if they're writing code that is being incorporated into a kernel.
3
-
3
-
3
-
3
-
3
-
3
-
3
-
3
-
3
-
3
-
3
-
3
-
3
-
3
-
3
-
3
-
3
-
3
-
2
-
2
-
2
-
2
-
2
-
2
-
2
-
2
-
2
-
2
-
2
-
2
-
2
-
2
-
2
-
2
-
2
-
I doubt anyone will see this, but recursion is always unnecessary and should never be used. People keep bringing up tail recursion but not every algorithm can be written that way and if it can, it's just as easy to write and understand as simple iteration. If the iterative and recursive solutions are written correctly and they indeed yield the same result, the iterative solution will never crash due to any internal influences while it's possible that the recursive solution will, regardless of embedded system or desktop computer. This is because the stack is still limited in size even on desktops. If a developer can't translate a recursive algorithm into an iterative implementation, then they likely aren't very good anyway. One of the examples I keep seeing is for Fibonacci numbers, but I think the better example would be Quick Sort. If you've ever implemented one the correct way, you'll understand what I'm talking about, and even if you haven't, you might understand it should you read any C standard library implementation of it. You can have a simple solution that generally works, or a correct one, and you can have a complicated iterative implementation or a complex one. In the end, it's down to the programmer's skill.
2
-
2
-
2
-
2
-
2
-
2
-
2
-
2
-
2
-
2
-
2
-
2
-
2
-
2
-
2
-
2
-
2
-
2
-
2
-
2
-
2
-
2
-
2
-
2
-
2
-
2
-
2
-
2
-
2
-
2
-
2
-
2
-
2
-
2
-
2
-
2
-
2
-
2
-
2
-
2
-
2
-
2
-
2
-
2
-
2
-
2
-
2
-
2
-
2
-
2
-
2
-
2
-
2
-
2
-
2
-
2
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
Personally, I'd advise no one to ever learn Rust. C runs on far more platforms, is significantly less bloated, and if you learn it well you can parlay those skills into other languages. However, you shouldn't just learn the syntax of C, but its standard library and all of the modern features that it provides, such as _Generic. The fact that the feature has been around for as long as it has and so many people still don't know of its existence is rather sad. If you learn C that well, then I'd suggest learning C++. If you learn C++ you'll have a much easier time doing just about anything and anywhere. If you're interested in game development, then definitely that path is the better option, but also if you want to get deep into the weeds and learn how to be a better game programmer, then learn about 3D math while you're at it and maybe even learn some assembly. I can't imagine that many, if any, people wanting to get into programming would deliberately intend to get into low level programming, writing drivers and so on, but if anyone does decide they want to do that, I would learn C and assembly in tandem and read the processor manuals from Intel, AMD and ARM. Both Intel and AMD have optimization manuals and they're definitively a must read even if you don't want to do assembly at all.
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
@d3line Nearly all programmers are bad programmers, this is a known fact. So instead of making it easier for them to be programmers and make far worse mistakes than common ones, let's instead shut them out. Linux has bugs because it has thousands of developers who probably shouldn't be allowed to contribute code to it. How many of those bugs are for the common core of Linux as opposed to drivers for hardware that not everyone uses? Do you know? Do you even understand the difference? A Raspberry Pi may not have the limitations of an Arduino or some other niche piece of hardware, but you still shouldn't be cavalier with resources. There are many applications where you need smaller hardware and using Java isn't an option, but what's more is like Rust, many of the features are unimplemented on such hardware and all you get is the syntax. Proving code correctness is impossible for a program to do, at best you can prove partial correctness, which is not good enough. If bounds checking is only done at compile time, then when your improperly written code encounters an out of bounds condition at runtime the check will have proven worthless. So it's slowing down the compile time for little potential benefit to prevent errors which don't happen with good programmers and no benefit for the runtime portion. So it won't slow down the running code, sure, but it won't catch the more pernicious errors. In fact, Rust won't catch the majority of the more pernicious errors which mostly occur because idiots slip through the cracks by learning languages like Java, Python, Go, C# and yes Rust. As for what Microsoft thinks, I don't care, I don't use Windows and won't and they can suck a big D.
1
-
@d3line Let's see, false equivalency, as flying airplanes is not the same as writing code. As well errors made there are more immediate unless you're using bad code. Oh wait, that's happened and they had to ground a huge swath of planes which had slow building problems because of poorly written code. For kernel vulnerabilities, do you have any idea how to trigger any of those? How long did it take to find them? On the RPi you just made another argument for me because a dingus like most new developers are these days won't understand algorithmic complexity and won't have any clue how to actually implement them. So good luck getting one of them to write good code for embedded systems and if they don't learn it early, good luck getting them in later years to do it as well. You mistakenly assumed I was talking about hardware features when I was talking about software features, as in what the language provides, or in this case fails to. And the point still stands that at that level, Rust and C are on equal footing except for a few points which as I said only apply to bad programmers. Bounds checking can be as simple as "you're using `i` to index the array and checking at the top against a.len()", but if you have a mutating index, as in based on data that may be external to not just the module you're writing but your entire program, it would have to either do runtime bounds checking for each access or none at all. For work on embedded systems you'll encounter that a lot. Airbags actually do cause more harm than good, so that's an invalid point right there. Microsoft still can't write a good OS, but you trust their expertise on writing good code? Talking to beginners is, hopefully, how I influence the world to be better. If I can dissuade ones like you from writing code the world is that much better, and if I can teach better ones than you to write better code by them learning better techniques, better still.
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
@d3line You're not making a whole lot of sense here. You don't support closed source, fine, I don't either, but to act as though no one else will, that's just stupid. If you're using a library you wrote yourself or one that someone wrote who is into open source, then yeah you'll see the potential failure points, but there will be multitudes who will be using closed source binary blobs and literally can not see into it without reverse engineering it. If you were claiming that Rust can't do that, and we both know you're not, then you'd be really idiotic. Instead you're obfuscating by alluding to one thing and saying the opposite, and don't tell me that's not intentional. With regards to low level code, you seem to be under the delusion that Rust will prevent all errors while still stating that it won't, or maybe it's just your unwillingness to acknowledge that you agree with me on this point, but at the low level some of us write code at, Rust offers no advantages that C doesn't also offer over and above assembly. Further, there are far more compilers and target system code generators for C infrastructure than for Rust. From the sounds of things, you seem to be confused about a lot. At least I hope it's confusion because the alternative is gaslighting. If you're writing code at a high level, as in not system level programming, then use Rust if you want, even if it's still not the right choice for any job thus far. It won't make your code better than anyone else's code, and if you're a bad programmer you won't compare favorably to a good programmer no matter what language you're using.
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
@sergiitk When you consider that you have to issue a separate instruction to store the index in a register, then decrement it, then either use lea then mov, or just mov, to read from the memory, it adds overhead. You say negligible, okay, but then process a list of a million elements and maybe you'll start to appreciate how much overhead it costs you. If you're curious as to why you wouldn't just use lea then mov, without the other junk, you might be dealing with object sizes that aren't a power of two, or are too large to be handled in that way with lea.
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
As to the schools, that's because they're run almost entirely by leftists these days. They're mental midgets who give participation trophies to ensure that no one is special because everyone is. Technical subjects shouldn't be taught by these creatures because they don't know what anything means or how anything works, they just want things to work on unicorn farts and sprinkles.
As to the issue of mainframes using Cobol, the financial institutions that use them want something that is solid, not something that will need debugging and they're smart enough to see that new code is often garbage. Also, they don't like spending money where they don't need to, and since the old code works, why spend money to replace it with something untested and untrusted. So if you want to make serious bank, yeah, learn Cobol. If you want to make fun programs that millions know they're using and might make you good money, learn C++. If you want to make useful programs that people know they're using but might not make you good money, then learn C. No one will know you wrote it if you use Cobol, but billions will use it, so if you want fortune but no fame, then go the Cobol route.
1
-
1
-
1
-
1
-
1
-
@linkernick5379 Rust doesn't solve the problem of cross-platform problems. They've explicitly stated a minimum CPU that it'll run on for x86 machines which means it won't run on half the desktops I have and then they target SBC's. It's just stupid is what it is and they're merely slapping people in the face. C is far more cross-platform capable, even if it requires you to use a configure script to make it easy, it'll still run on really old platforms that Rust gives the middle finger to. And nothing is more interoperable with C than C. As for safe {insert X}, that's BS. It makes you work harder to be unsafe, making it an even more intentional decision to be so, but it doesn't make you safe as a blanket statement. You have always had the option in C, and intelligent programmers have taken that option, to write libraries of code that you reuse which abstract a lot of things making future code that you write as safe as can be. Who in their right mind rewrites linked list code whenever they need it in a project instead of just using the code they already wrote, if you even use a simple linked list anyway. And finally, defining the tooling that every programmer will use to interact with your language is a really stupid idea. It creates a vague understanding of the underlying way in which the code will work and makes it impossible to replace in the future. Using LLVM as they do is a pretty cheap way to push out a new language, but that further has them depending on a separate project while they're attempting to define the tooling and they still restrict it.
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1