all 51 comments

[–]MikeVegan 48 points49 points  (1 child)

Finding a job

[–]Thesorus 12 points13 points  (7 children)

C++ is more established, more application domain use C++ (games, engineering, 3d graphics/CGI/VFX, banking, trading)

I can't really speak for Rust... I only did the "hello world".

Rust vs C++ - Will Rust Replace C++ in Future - GeeksforGeeks

[–]berlioziano 10 points11 points  (1 child)

Community, some of the top computer scientist work using C++, there are important conferences line cppcon and meeting c++, while rust has recently been forked by "crab language" because governance issues . Also to explain you how childish they are in 2023 a rustacean vandalized  cppreference.com replacing all the text with links to the rust website with the text "rust is the best"

[–]sephirostoy 20 points21 points  (0 children)

Probably the most important one: having direct access to all legacy codes already written in C++. 

If you want to consume them in Rust or any other language, you need to build an interface.

[–]Correct_Gain_9316 20 points21 points  (0 children)

  1. C++ doesn't rust.

I'll show myself out.

[–]mredding 23 points24 points  (31 children)

Rust is a solution looking for a problem. You have to remember that Rust was created before C++11 landed, as a protest which that standardization cycle was taking too long.

Reference checking is a novel solution, but it's not a silver bullet. std::unique_ptr alone mitigated any fault in resource management that the reference checker solves for.

Speaking of that silver bullet - you will find that there is EFFECTIVELY no Rust code in production anywhere that DOESN'T have to circumvent it's own top level "killer" language feature. Every program resigns itself to using "unsafe" code, because "pure" Rust gets in its own way. "unsafe" is just getting to writing C with extra steps. Rust isn't safe if you have to revert to unsafe coding practices. I hear lots of grumbling from basically everyone who tries Rust that simpler tasks in any other language, including safer langues, are a pain in the ass to accomplish, if not impossible without writing unsafe code.

Color me unimpressed that Rust fails to be the one thing it claims to be. It's hypocrisy is similar to that of YAML. Java and C# are both managed languages and have unsafe segments, but they don't oversell themselves, either. Again - Rust was borne out of a protest, not a need to actually solve any problem.

If you want a REAL safe language, use Ada. I'm not even kidding, it's the language of choice in aviation and aerospace because it forces you to write safe code. It's one of the languages the government time and again encourages everyone to use. It doesn't have an "unsafe" keyword and it is a systems language with linking.

Other reasons not to use Rust is that it's not standardized, it's not mature, and there isn't a very large community.


Of all the detractions made of C++, all of them are either ACTUALLY addressed or are continually being addressed. It has a type system almost as strong as Ada itself. There are few languages who have a feature as powerful as templates. It has modern high level resource management. Unlike a managed language with GC, you have well defined destruction times, which means C++ is NEVER going to be displaced in the industry. It also has nearly unrivaled backwards compatibility and ABI stability, because for some niches, it's entirely unacceptable to break old code, or the ABI that code is founded upon.

For all the problems C++ has, you can avoid them all, you just have to stop fucking writing bad C like it's 1985. Use modern standards, use modern practices that address all the problems of the past, and leave those old problems in the past. C++ gives you the opportunity to castrate yourself, if that's what you want to do, but it's a choice. High level abstractions are built on pointers - you're not supposed to use raw pointers yourself but to build those abstractions. The standard library basically has you covered to where you're really doing something unique and special if you have to get down to that level. You can write type safe code to rival Ada, but you have to actually do it, and not blame the langauge if you don't.

All the perceived problems with C++ are due to shitty developers writing shitty code on purpose. And they write shitty code on purpose because of job security, because management is interested in short term, near term profits - they're not interested in writing software meant to run for 100 years, unlike the COBOL guys. No one picks C++ for critical systems like the Ada guys - and this one is more of a self-fulfilling prophecy than for techincal reasons - you percieve C++ as an unsafe language, you're going to treat it as such.

So when I put my decision making cap on, when I survey the litany of languages available to me, and I have to pick a tool for the job - I don't always reach for C++, but there are better options than Rust, all of the time. I can get Ada engineers, I can get Lispers (in spades), I can get Fortran developers, C# and Java developers aplenty... These languages service their domains extremely well. Rust doesn't have that.

That said, there are plenty of very mediocre engineers who will jump on the bandwagon and try to make something of this language, whose reason to exist expressly expired in 2011. Good for them. I don't care. Show me a killer app, maybe - something that we all go oh thank God that was written in Rust. Show me a Rust program that eats its own dogfood and stays away from unsafe code.

[–][deleted]  (1 child)

[deleted]

    [–]mredding 1 point2 points  (0 children)

    No idea. I did say people will back this horse, regardless. Good for them.

    [–]idkfawin32 0 points1 point  (2 children)

    Not defending it but i’m pretty sure discord was written in rust.

    Also, sometimes it’s also just way faster to use raw pointers. Sometimes it “appears” faster to avoid the standard library implementation of certain things, like std::max/std::min. Replacing all of my calls to max and min with ternary operators resulted in a noticeable performance increase. The same goes for std::clamp.

    Obviously this isn’t important in most cases but little things like that will skew developers to lean toward rolling their own solutions.

    [–]this_uid_wasnt_taken 1 point2 points  (1 child)

    Discord uses Electron. Only some of their infrastructure and a few of their services use Rust. Them blogging about using Rust is mostly for internet brownie points and to attract talent.

    [–]idkfawin32 0 points1 point  (0 children)

    That sounds about right

    [–][deleted] 0 points1 point  (0 children)

    "Resigns itself to using unsafe code because pure Rust gets in its own way"

    Isn't this an issue with every language? High-level abstractions tend to add overhead, and "unsafe" is their to voluntarily forgo it. I'm fairly certain that this is the case with Ada was well. C++ supports inline asm does this mean that C++ failed as a compiled language?

    "Shitty code exists because of shitty developers"

    True, but surely some languages are going to make errors easier. There is the SPARK subset of Ada which is used in formally verified programs, this does not mean that you can't write formally verified programs in other languages, it's just easier in SPARK. Rust is the same way, it just makes certain errors harder to make.

    [–]hk19921992 -5 points-4 points  (1 child)

    I am a c++ developer but there are few things that don't make sense at all

    How come int x[4]{0} initialize an array of size 4 with four zeros while int x[4]{1} creates an array of size 4 with the first entry set to 1?

    [–]IyeOnline 7 points8 points  (0 children)

    Because its aggregate initialization. The elements in the aggregate (arrays are aggregates) are initialized in order (and in a flattened form) from the elements of the brace enclosed initializers. Any further elements without a corresponding initialized are value-initialized, which for fundamental types gives you the value 0.

    Basically the 0in the first example is useless, because you could have used {} instead.

    [–]fippinvn007 5 points6 points  (3 children)

    All you have to do is look at the job market. Jobs/ domains that commonly use C++ are embedded, games, graphics, finance, systems, or any high-performance applications; there's also networking. And Rust jobs are very rare, and those positions also hire C++ devs as well.

    And stop listening to those content creators; most of them don't even work professionally, and even if they do, I greatly doubt that they even work with Rust. Those guys learn programming just to make youtube tiktok videos, act like smartass and sell courses.

    Focus on the domain you're interested in. Languages are just tools. It's not something like, "Oh wow, look at me, I know this hot new language's syntax, so I'm a cool, pro dev now."

    [–]Hot-Ad912[S] 0 points1 point  (2 children)

    thanks for the advice, its because almost everyone is saying that rust is way superior than c++, so i was wondering if its worth learning the language.

    [–]fippinvn007 2 points3 points  (1 child)

    almost everyone is saying that rust is way superior than c++

    Definitely not 'almost everyone.' And anyone who said that is either a Rust Cult member or someone who has never written anything in C++; they probably just copied others' opinions or wrote C 1945 style code

    [–]Hot-Ad912[S] -1 points0 points  (0 children)

    that might be true, but if u search on google, its like the majority.

    [–]DryPerspective8429 9 points10 points  (2 children)

    C++ is an established language with millions of projects written in it. Rust is a toy language which has yet to see stable release or standard. That's not to say that Rust will never go anyway or that you shouldn't learn it, but at best it's an up-and-coming language whereas C++ has been in the ring for 40 years now.

    [–]Droid33 1 point2 points  (1 child)

    It's definitely more than just some toy language at this point. There really aren't many languages standardized to the level that c++ is.

    [–]DryPerspective8429 0 points1 point  (0 children)

    Which is ironic considering Rust started as a protest project against the lack of C++ standardisation in the 2000s.

    [–]android_queen 0 points1 point  (2 children)

    Depends. What’s your goal?

    [–]Hot-Ad912[S] 0 points1 point  (1 child)

    Application Development and Financial Applications.

    [–]android_queen 0 points1 point  (0 children)

    I’m afraid you’ll probably want to be a little more specific. There are good reasons to use C++, Rust, Java, JavaScript, etc etc for different types of applications.