Comments by "" (@diadetediotedio6918) on "Brodie Robertson"
channel.
-
29
-
24
-
5
-
4
-
4
-
2
-
2
-
@MrjinZin0902
Yes, C++ has duct tape over its problems, the question should be whether this historically solved the problem of security in software (spoiler: no). If I take 10 random repositories on Github made in C++, from the tests I have done, the probability is that a significant portion of them still use pointers and manual memory management, this is trying to severely modify something that is already established in a way, add a new way of thinking about things. Think about the language's perspective, the amount of educational material built on top of it that doesn't use it, the amount of tutorials and examples, and the amount of additional learning difficulty that using a concept like this adds to the language. Just think about it, if this feature were really effective, we wouldn't be considering using something like Rust in 2022.
Rust on the other hand doesn't depend on additional learning, all his material is based on the notion of security, all the things you learn take this fundamental fact into account, if you make a silly mistake the compiler will yell at you and tell you why are you wrong. When I learned to program in C++ many, many years ago, the unique_ptr feature already existed, however I had never met a single person who recommended its use. A few years later I went back to finish learning for some uses, and still I didn't find anyone who recommended these techniques in the countless tutorials I delved under. Rust is also about a lot more than memory safety, it's about concurrency safety, this is something that comes by default, it's incredibly more complicated to write code that incurs concurrency issues with the language than it is with C++, and that's another one of its selling points.
There's a lot more to consider than features of a language, you also need to think about the human structure behind it, and you need to think about the code structure it will compel you to do (Rust will compel you to make code immutable by default, will compel you to manage references in a way that is safe to share, will compel you not to leak memory from the first moment you use the language, this is something that cannot be overlooked).
2
-
2
-
@MrjinZin0902
There's a cost to everything, you should know. C++ doesn't solve the concurrency problems, that would be something very complicated, to say the least, with a language like that (of course, if you believe it solves it, you're free to demonstrate).
I believe the simplest way to solve something is to give reasons to support it, I believe Rust is a more interesting tool than C++, because Rust has built-in security by default, which makes insecurity explicit and security implicit ( unlike C++). And because Rust is effectively touted as a safer replacement for C++, even companies like Google and Microsoft have been talking about it for some time now, I'm not saying they own the truth or anything, just that it's a fact that Big players are worrying so much about something like security risks caused by bad memory management, there's something fundamentally wrong with the way software in general has been developed. And if even Torvalds, a difficult and rather inflexible person, is considering Rust to be placed inside his precious kernel, I think this is no coincidence.
See? We have many, many, many signs of reality that C++ is effectively being used the wrong way or just doesn't solve the problem. In either of the two answers the simplest solution is to ditch C++, and Rust has been considered that way because it eliminates most of the things that cause security problems by default.
This is a very simple conclusion.
2
-
2
-
2
-
2
-
1
-
1
-
1
-
1
-
@dave7244
Well, let's go. I'll take this a little more seriously for the sake of discussion.
1. The hello world program doesn't generate 12mb, I literally created one just to check if that was true, in total we have 5mb including configuration files, debug symbols and the git repository that is created by default. The final release mode binary is around 125kb.
2. This is a pretty ugly thing to assume. See, if the fastest and most efficient programs are the ones compiled in -O3, why isn't that the default? The answer is that there are reasons, reasons that need to be carefully balanced by the programmer when creating a build. I've done C builds that quietly took up over 300kb with just a little code, does that mean there's an inherent problem with the language?
Rust has levels of optimization and balance, when you use the standard library you are using code written very carefully and that makes a lot of use of language resources, code that will be statically included in your binaries when compiled, this increases the performance of program execution at a cost of a little more space. Do you know what else increases performance (in their respective cases) at a cost of space? Inlining. Rust also does a lot of inline in the code, not only that, it also focuses on doing a lot of vectorization and loop unrolling where possible, and as expected this results in bigger binaries, does bigger binaries mean worse code in this case? Hardly anyone serious would say that. This is a trade-off of space for time, something quite simple for a developer to understand.
Rust also uses LLVM, I've heard in the past that LLVM would produce bigger binaries, for better or worse, it's something that needs to be considered, of course with the new GCC based compiler (when it's stable) we can get an idea if this is also a point to consider.
3. Finally, if size is all you care, we can make the binaries smaller, using some profiling tools to eliminate the static linking of binaries with stdlib, you can make your hw 99kb, a 20% improvement compared to common builds.
Your question should be, do I really need to do this? Is it so absolutely important to save 150kb in a world where 1GB of hard drive can cost much less than 0.01 cent of a dollar? That sounds like a pretty hollow critique when we put it into perspective.
Assuming you're talking about using this for embedded, one of the language's proposals, that would be a valid thing to say... if it were actually true. As you would with C or C++, if you forgo the conveniences of the standard libraries, you can create very small binaries to use in your embedded ones, so the size of your hw binaries should be close to a mere 9kb.
---
That said, I still expect to see positive changes in the switch to the GNU compiler, and time should bring even more exciting things with it.
1
-
1
-
1
-
1
-
1
-
1
-
@anon_y_mousse
This doesn't make any sense, no one is saying you are inferior if you don't use Rust, we're saying that not using Rust lowers the overall safety margin of software and that's a bad thing. Most people who don't like Rust are C++ programmers who simply believe that their language is divine and that you just need to be a good programmer so that mistakes don't happen (doesn't that remind you at all of the elitism you talk about? ).
Rust doesn't diminish any knowledge either, it lessens the risks of making unsuspecting mistakes, you can still make conscious mistakes if you want, the difference between Rust and low-level languages like C/C++ is that most of the time you need to be conscious to writing bad code, and that's something that increases security effectively, because humans really do make a lot of mistakes. If this is elitism then using safety belts would be, using magnetic screwdrivers would be, wearing gloves when handling electricity would be, using switches instead of simply plugging in and unplugging wires would be, etc.
1
-
@anon_y_mousse
I honestly don't know which Rust programmers you've been talking to, could you show me an example of this toxic behavior? Because I can fully, right here and now, take you 10 recent discussions I had with incredibly toxic people in the C++ community, demeaning Rust programmers (in fact, I've seen many trying to attribute characteristics to Rust programmers, such as being "estrogenated" and as if the requirement to be a rust programmer is "lack of balls", does that sound like healthy behavior to you?). I don't think you understand what programming really is, because you have the false belief that something like "being a better programmer" has to do with being a "bulletproof" programmer, that's a childish thought, and a experienced programmer would quickly tell you how destructive this is. Programmers simply make mistakes, whether they are beginners (who naturally make more mistakes) or veterans (who will make fewer mistakes), humans are human, they make mistakes, and if they weren't unintentional things they wouldn't be called mistakes but bad actions . A security bug caused by a memory management problem could ruin the lives of thousands of people dependent on this critical system that is Linux, which is precisely why we need to improve not only our programmers but our tools, make things more difficult making mistakes does not mean failing to teach the principles behind mistakes. The seat belt analogy is excellent for exemplifying this, even the most veteran and capable drivers are at constant risk of having an accident, whether caused by themselves or others, which is precisely why using artifacts such as seat belts decreases the margin of human damage and is considered a positive thing, that's why we also endorse the use of safer brakes like ABS, even though the old brakes are perfectly functional, this is not to make people "less efficient drivers" , but to make them less susceptible to unexpected human error. Is it so, so difficult to conceive of this concept as a concrete thing?
1
-
1
-
1
-
1
-
1
-
It's an interesting question, really.
In one situation, a person is placed in an incredibly green and beautiful place, he must cross this beautiful lawn to reach a specified destination, then he will earn a reward. She has the possibility to get there using an alternative path, with much more dangers and challenges. They make it clear that going the standard path will take less damage than going the alternate path, and that the reward will be the same even if it takes a little longer.
In another situation, they place a person in a seemingly solid place, but full of hidden dangers, there is no warning or fanfare about the situation that person finds himself in, there is only the fact that he needs to arrive at his destination to receive his reward. She may struggle and learn to dodge danger, get into a "safe context," but doing so will slow her down.
Which of the two people seems more likely to have fewer injuries at the end of the course?
1
-
1
-
1
-
1