3 ms·
Some people (like myself) just prefer C++ to C#.
by rhodysurf 11y ago
Some people (like myself) just prefer C++ to C#.
- paulddraper 11y agoThat's fine. And surely you'll agree with the GP that they're not really comparable.
- blub 11y agoThey are both used for building UI applications on Windows, because there's a lot of existing C++ code, .NET used to be (not sure now) a major PITA to deploy and was slower to boot. It also allows one to expand to other platforms and operating system in a way that C# never could, in spite of toolchains like Mono, and the recent open sourcing of .NET. I would absolutely not choose C# for building a UI app even today.
- pcwalton 11y ago> I would absolutely not choose C# for building a UI app even today. Even if memory safety is important to you (the point of this subthread)?
- blub 11y agoI don't really think about "X safety", but rather about various quality attributes such as availability and resilience, perhaps also security in this case. These have to be evaluated and kept in balance with other attributes such as performance, portability, dev resources etc. I would personally prefer to use various engineering practices such as static and dynamic analysis, unit tests, etc rather than change programming languages. There's also the other side of this argument: my last project was Java. C++ would have allowed us to port more easily to other platforms (a current pain point) and get better performance in combination with OpenGL (another major pain point), however, the project constraints would have made it extremely difficult to bring a C++ project to market with the resources we had.
- pcwalton 11y ago> I would personally prefer to use various engineering practices such as static and dynamic analysis, unit tests, etc rather than change programming languages. There is no static and/or dynamic analysis out there that effectively stops programmers from writing UAFs (to name one especially problematic class of memory safety problems) in C++ over and over. This is despite decades of work on it. The language itself is fundamentally hostile to analysis. I also dislike "one language to rule them all" thinking. Web app and network backend developers shed that mentality a long time ago, and the industry is better for it. Java, Ruby, PHP, Python, Go, JavaScript, Scala, etc. are all used on the server where their niches are strongest, and this is great! The industry would have been in much worse shape if they all had tried to stick with C++. I agree with your other points, though--the choice of programming language has to be balanced among many factors. Sometimes security against RCE doesn't matter or isn't relevant, and the crashes caused by memory safety problems can be lived with. But I don't think we should pretend that C++ is safe, or as safe as other languages. It just isn't, and no tooling so far has been able to make it so.
- paulddraper 11y agoThere are good reasons to choose an unamanged language, but this part strikes me as odd. "my last project was Java. C++ would have allowed us to port more easily to other platforms" I'm not saying that you must wrong for your particular situation, but as soon as you've compile Java, you've essentially ported it to a massive number of platforms. https://en.wikipedia.org/wiki/List_of_Java_virtual_machines https://en.wikipedia.org/wiki/List_of_Java_virtual_machines If anything a dependency on OpenGL would limit your choices.
- sawwit 11y agoWhat are the advantages?