Is C++ truly on the path to obsolescence or is this a meme pushed by Rust shills?

Is C++ truly on the path to obsolescence or is this a meme pushed by Rust shills?

Other urls found in this thread:

benchmarksgame.alioth.debian.org/u64q/compare.php?lang=rust&lang2=gpp
youtube.com/watch?v=JhgWFYfdIho
cs.cmu.edu/~rwh/papers/mtc/short.pdf
twitter.com/SFWRedditImages

di you know that
C++ doesnt even do simple things like
checking bounds?

Rust certainly is a better language but too different and difficult for mass adoption.

Check your own bounds, it's not difficult. Or don't, and gain some speed if you need it. Or use range based for loop `for (&x : X) {…}` style access and don't worry about it.

Did you know that you can shoot yourself with a gun? Lets ban guns forever!!!

>Or use range based for loop `for (&x : X) {…}` style access and don't worry about it.
this is why c and c++ fags are so cancerous.
>MUH NEAT TRICKZ
>MUH CLEVER WAYZ TO CIRCUMVENT CRITICAL DESIGN FLAWS

If you can't do something as simple as checking your own bounds then you deserve to be gassed, you fucking retard.

There are tons of high-quality libraries and tools written in C++ that aren't going anywhere. In a world I'd desire more, Rust replaces C++ for lots of new development in things like servers, games, compilers, etc. because you can write easier-to-understand code that's demonstrably correct in ways lots of widely-used software isn't right now, but realistically speaking, C++ will never go extinct. There's a lot of momentum behind C++, while Rust is still trying to gain momentum.
t. Rust fanboy

C++ is like a shotgun that blows up in your face every time you shoot it.

If you can't do something as simple as demonstrating your software is obviously not going to crash (whether by using a properly-designed type system or with something like separation logic), we should assume it will.

"C++ is dead" is programming version of "PC gaming is dead".

They have been saying "C is dead!" for about 20 years now.

It's not "a neat trick", it's a decent way to do something.

Your bounds checking program is still going to fail if you try going out of bounds, so you're going to have to deal with it one way or another.

Can someone redpill me about rust? Does it really work as fast as c++?

If you keep pointing it at your face, then yes. But when it shoots, it shoots, instead of giving a weak dribble of water.

Also C++ has changed a lot over the last decade, you should check out the new features, they make writing good safe programs much easier.

No. Higher layers of abstraction are always slower than lower layers of abstraction. Rust cannot be as fast as C++ because it has too many layers, like a very large onion.

C++ can't even split strings lmao

>C
>Not dead

>second most popular
>dead

...

For the most part, its abstractions are similar, just type-safe. Hence the comparable performance:
benchmarksgame.alioth.debian.org/u64q/compare.php?lang=rust&lang2=gpp

Check out Java "dying" over and over.

Good. I don't think C is able to bounce back like Java though, it's doomed to death.

>github
Please, do not. Github is where high professionals and total noobs both congregate.

C may die, someday. It is not dead yet.

Notice how rust isn't even on that list. I wonder why...

Thing is, noobs do't do many pull requests.

Notice how C went for a steep decline when Rust came out. I wonder why...

c++ is dead
the future is go

> My OS will be run under a garbage collector

yeah, that's bait

>implying you need soft kind of ~predictable~ memory collection for your meme os use cases.

What else would I use for kernel programming, drivers, and embedded software?

php

how is a horrible language like java and its messy api so popular?

They started teaching it in all of the universities / programming programs, so it became one of the most well known languages among the fresh meat.

C++

Now: C++
In future: Rust

Embrace the future grandpa.

If you enjoy being a human compiler and doing all the busywork that a compiler is supposed to do for you, then C/C++ is *not* obsolete

If you have better things to do then do bounds checking on arrays, making sure strings handling functions dont run past a null character, make sure pointers spread all over your code dont point to a deallocated object......I could go on and on and on and on with all the stupid bullshit boilerplate hand-compiling that you have to do in C++

It has the best documentation of all the major languages.

>If you have better things to do then do bounds checking on arrays
Just use vectors, they support pointer artithmetic and everything

>making sure strings handling functions dont run past a null character
C++ handles that

>make sure pointers spread all over your code dont point to a deallocated
C++ handles that

Thing is, modern C++ is reference counted. But due to source level C compatibility it's pretty bloated and lacks some basic features from other modern languages.

Its not even funny argueing with C++ retards anymore, all the can come back with is
>XXX.template.method takes care of that blah blah, generics blah blah muh RAII
go ahead, knock yourself out with an endless amount of template libraries solve problems no one else even thinks about

It's not that hard man, for strings C++ has a string class that is not that different from something like java. No templates, no bullshit. For dangling pointers you just use smart pointers, for example:
auto anIntPtr = make_shared(42);
if(anIntPtr)
(*anIntPtr)++;
anIntPtr = nullptr;
if(anIntPtr)
(*anIntPtr)++; // Never executed

Dont get me wrong, I love golang, but that shit needs to stay on servers.

Shouldn't have set it to null for a dangling pointer example, but it works the same.

The one-hour vid related is what I have to watch to understand how to use std:::tuple:
youtube.com/watch?v=JhgWFYfdIho

C++ wasn't designed with an understanding of something as rudimentary as product types (tuples), and as a result every product in the language has to be represented as a class whose elements may be nulled or invalidated (as Lavavej briefly points out, because the product can be projected from and then modified).

In any type-safe language made since the late 80s, I introduce a tuple with (a, b, c) or [a, b, ...] and can project out just as easily. In something like Ocaml, there is minimal overhead, and in something like Rust, there is none vs. C++. There is no way for the tuple to be invalidated.

This is one example of hundreds I could have given.

C++ programmers spent dozens to hundreds of hours learning all the ways the constructs they're given can go wrong, and despite this still make subtle mistakes, to the point where it becomes a source of pride, even though every part of their job would be easier and less error-prone if they'd simply adopt better tools.

wow, thanks for posting your stupid busywork bullshit that I am never going to even have think about, since you enjoy doing needless senseless work I would like you to mow my lawn sometime

It has libraries for that, moron.

You seem upset, is everything okay user?

How is it busywork?

C++ is a multi-paradigm language. You don't have to use all of its features. Don't blame your incompetence on the language.

>>Check your own bounds, it's not difficult. Or don't, and gain some speed if you need it. Or use range based for loop `for (&x : X) {…}` style access and don't worry about it.

The latter is what Rust uses as a zero cost abstraction. The main difference is that a[i] is bounds checked, while a.get_unsafe(i) (which is used internally in iterator methods) isn't.

Safety should be the default, removing safety should be an option. With that said, I significantly prefer Julia's @inbounds macro to Rust's approach here, Julia just gives you a block within which all automatic bounds checking is disabled so that you can easily debug with bounds checking on and then disable it for your final application.

Go drink some bleach and shoot yourself in the mouth, you dumb fucking shit stain.

C++ has a lot of problems, and really needs a cleanup, but its not going anywhere.

WTF why would I want to waste speed checking something everytime that is a problem 0.1% of the time.

...

>The one-hour vid related is what I have to watch to understand how to use std:::tuple:

what world do you live in

I wasn't complaining of lack of features. The features C++ now has are syntactically awkward and don't work properly because they were grafted onto a design that isn't possible to fix (in this case, lack of real product types, but there are other examples).

but it can if you want it too.
its simply faster to make such things undefined behavior so the compiler can assume it never happens

standard libraries usually let you have safety checks for those kind of things in debug mode anyway.

hopefully c++ gets contracts soon.

>C++ wasn't designed with an understanding of something as rudimentary as product types
structs are good enough

anyway, builting (a,b,c) or similar style tuples also just dont really go well with c++
the language is getting better to work around it though.

what's a good vectorization/math library for c++? need intel specific instructions
ta

Bullshit. Name one. Also "syntactically awkward" is subjective but I'll bite.

this
I learned java from a "Programming Fundamentals" course.

>With that said, I significantly prefer Julia's @inbounds macro to Rust's approach here

I will admit that I switched from C++ to Julia for my last few projects. Mainly because I'm doing a lot of number crunching, and having everything just there, with a REPL, makes everything million times easier. Speed is pretty decent too (about 5x slower than C++ for the stuff I'm doing, I'm finding).

Java:
{
Foo f = new Foo();
f.blah();
} // f goes out of scope, GC will pick it up at a later time


C++:
{
auto f = make_unique();
f->blah();
} // f goes out of scope, destructor is called and object is immediately deleted.


>MUH BUSY WORK

Btw, for such a simple example like that, you'd just create the object on the stack like this:

{
Foo f;
f.blah();
} // f goes out of scope, destructor immediately called.

>Bargaining

Go is for networking. it was designed to replace C++ for Gulag's servers/db

They still use C++ for the backend, Go was designed to replace Python and Java. I have no idea why gophers pretend it has something to do with system programming.

>C++ ((((programmer)))) showing off how pointers to objects automatically go out of scope
I was thinking making a retard joke, but this just goes so far beyond retardation to brain dead levels of stupidity

What's the problem, retard?
The object is deleted.

thats nice, go show your mommy, Im not impressed

You got proven wrong, fucktard.
Deal with it.

have mommy give you cookie for making a pointer to an object go out of scope retard

>This amount of butthurt

>literally devolving into a state of babbling retardation when proven wrong
hmm

I'm not a Rust fan, but IMHO, yes, and C++17 shows why.
C++'s approach to language innovation is simply "add more stuff", which has inevitably made it a bloated mess. I used to really like C++, but I can't deny the truth any longer: C++ is just overcomplicated. It detracts the programmer's attention from actual programming thinking and directs it to remembering a huge amount of gotchas.
If it goes on like this, many others WILL eventually realize the direction it's going to and leave it.

Did you know, and I know that this is going to be mind blowing to hear, but did you know that you can check your own bounds?

I know. Take a minute. Breathe. Let it sink in.

You can in fact save yourself several thousand CPU cycles a second by having your code self-manage its own bounds check, and to only do so (and act accordingly) when it needs to.

Fucking mind blowing, I know! It was like that for me as well. It sent me to a mental hospital for a week. I was SO triggered by this realization. Just wow.


Fast code that checks its own bounds when needed... Haha wow. We truly live in an era where sci-fi has become reality. :)

C++ has it's own problems but Rust is in a completely other level of shit.
Fuck Rust and fuck the letsrewriteeverythinginrust shills and faggots in reddit and phoronix

>get rust 1.9
>write something, it werks
>get $new rust
>code breaks
the language isn't even fully stabilised yet reeee

ok, starshipeleven

Java would use escape analysis to automatically allocate on the stack in this case anyway.

The only people who use C++ are rural and suburban retards.

City people use Rust.

>tfw C++ farmer
>tfw suburban retard

I think C++ is awful but that's because I'm a C fag

There's nothing wrong with wanting C to be the only programming language that exists
Someday it will be

>checking bounds
what do you mean? like integer overflows and shit?
no language does that and that's why we have hackers

sorry cunts, you can't do anything modern and useful in C

the future is Matlab

>C++'s approach to language innovation is simply "add more stuff", which has inevitably made it a bloated mess. I used to really like C++, but I can't deny the truth any longer: C++ is just overcomplicated.

So stop using the old ways of doing things and move to the new ways. This way C++ can continue to support the huge amounts of old code that's been written already, but still let new programmers use all the cool new features. Just learn the bits you want and move on.

I mean, what are the C++ designers supposed to do? Just say "all old software will no longer compile", or "we can't add anything new, so C++ will stagnate, if you want new features find another language"?

>the future is Matlab

If Matlab is even remotely close to the kind of environment you want to work in, then the future is Julia

Julia didn't take off though

Yes it did, I'm using it right now, as are several people in my department. New packages are being added all the time and it's being actively developed.

It's just about to hit v1.0, then people are going to be far more comfortable using it.

Was asleep.
>Bullshit. Name one.
Okay.

The most obvious one is the lack of sum types that let you exhaustively match on several variants. The closest thing in C++ is the switch statement that lets you non-exhaustively match on integers. There is no way to case-handle or destructure complex datatypes, for instance when parsing or decomposing data. The alternatives you must use require at least as much overhead when compiled and are far more cumbersome.

Standard ML, Ocaml, Haskell and now Rust all have a sensible (did I mention type-safe, which also makes compilation faster and more convenient while providing a bunch of invariants?) module and package system. C++ has yet to standardize one. Haskell and Rust have typeclasses and traits, respectively, where C++ has yet to standardize the uglier, post-hoc concepts system that provides analogous functionality.

With C++11+, we finally have type-safe boxes (recursive data-types) as a kind of class, but they're still less complete than Rust's: std::experimental::atomic_shared_ptr::operator shared_ptr is not stabilized across compilers like Rust's Arc.

Concurrency and parallelism---and the dozens of functions and classes they define---are still experimental. In Rust, they're stable.

You can never assume even new C++ code will move rather than copy. In Rust, this is explicit---as is all ownership.

Rust has a hygenic macro system where C++ has C macros. Rust has a type-safe System F-based generics system that handles even object lifetimes where C++ has a template substitution system that may never terminate without explanation, may fail to substitute properly, is hard to predict in general, and whose only advantage over Rust is that it unintentionally enables a kind of dependent typing (so you can almost treat C++ as a theorem prover that proves no meaningful theorems).

I understand needing C++ for great libraries, but I see no reason from-scratch code should be written in C++ instead of Rust.

Haskell and Rust have package systems, but not module systems. Don't confuse namespaces with genuine modules.

>muh department
>several people
like I said, it didn't take off in the real world

>going to be far more comfortable using it
it hasn't happened because people are basically divided between python and matlab and there's no need for in-betweenness

You're right.

They all have package systems. The ML family has modules. Haskell and Rust have the trait/typeclass thing I mentioned, which is similar to the module system:
cs.cmu.edu/~rwh/papers/mtc/short.pdf

I stand corrected.

I'm actually trying to learn C++ right now.

What are the best IDE and compiler or IDE compiler combo?

All the lists I can find are several years old and most of what they recommend hasn't been touched for one or two years.

I'm trying to avoid using anything provided by Microsoft.

It was fine before the pythonic bloat.

emacs and g++

Arguably the best IDE for C++ is CLion.

VS and VSCode bretty are bretty good, but you said no M$ desu.

I write C++ in Emacs. Many write it in Vim. I think being able to write C++ with a text editor and a modern compiler is a good skill to have.

vim and g++

According to the TIOBE index (if you don't care for that, suggest a different one), it's ranked #35, with 0.6% usage. That's above Lisp, Scala, and Clojure. For a language that's not even reached v1.0, that's not too shabby.

Also telling is that some of the lead developers from R (e.g. the guy who's in charge of maintaining lme) has jumped over to Julia.

So I find it hard to accept "it didn't take off", given that it's only ever increased in popularity.