You don't know me, so you assume I don't know what I'm talking about. I'm not bashing about C++ because I don't know it. I'm doing it because I do know it. (I've been a C++ system programmer for 10+ years.)
I don't care about you or your appeal to self-authority. I'm going to assume you don't know what you're talking about because most people don't.
And stop having a chip on your shoulder, and I was comparing C++'s safety merits relative to Python's, because there are some.To say "If you know how to use C++, it's a very safe language" is a no-statement. Everything, even assembler, is safe if "you know how to use it". That's not the point about safety in programming languages.
That's not true. Even if you "know how to use" assembler, there's still a high probability of yourself creating a memory error. Unless you're using a statically typed assembly language or something. If you "know how to use" C++, you can reduce the probability of memory errors in most of your code to zero. You of course have to restrict yourself to a subset of the language and standard library -- at mundane levels such as avoiding certain functions like std::vector's operator[], and at other levels such as using smart pointer types, avoiding pointers entirely, using non-cyclic data structures, just tolerating some copying, and avoiding STL-style iterators."C++ provides the best resource safety of any mainstream language"??? Yeah, dangling pointers, memory leaks, array boundary breakage... All signs of "resource safety". The opposite is true: I'd say that virtually every other mainstream language today has a much higher level of resource safety than C++. (Alas at the expense of resource hunger, but that's another story.)
The only way in which C++ is particularly unsafe is memory safety. Which is, of course, the most important one. In other cases, C++ has stronger control over resources, because it had to tackle this problem head-on regarding memory safety. For example, in C#, you could just write var x = File.Open("blah.txt") , or whatever the API is. The file won't get closed until the object is garbage collected. Maybe you realize this so you write x.Close(). That's still not exception-safe. So okay, like any good C# developer, you write using (var x = File.Open("blah.txt")) { ... } . It's much easier to hold references to resources like files and connections longer than you intended in languages that are not C++, because C++ gives you exception safety without having to know that something is IDisposable.
Maybe you're so worried about dangling pointers and array boundary breakage because you don't know how to use C++. Yes, I am trolling you. And yes, I might be right.I observed a funny thing during the last decade or so: Usually people who are in flaming defense of C++ (or anything "conservative") are quick to taunt its critiques they wouldn't know what they were talking about.
I have observed a funny thing in forums for the last decade or so: people tend to project their expectations of people's attitudes onto their interpretation of what they're reading. Truth is, it is usually the defenders who don't know what it means to work in a more advanced language. The most passionate C++ fundamentalists (and rigid opponents of Java, .NET, or really anything invented after 1990) that I've ever met have never seriously programmed in anything but C and C++. Seems to me like BMW owners who refuse to believe that a Ferrari (or anything) is faster than their beloved car brand. ;)
I'm not sure if there's anybody in this thread you're referring to, besides that guy who downrepped you for some reason.