Rust or C++

I am coming from a C background. What should I learn next to use for command line applications? C++ or Rust, and why?

Attached: guaranteeing-memory-safety-in-rust-2-638.jpg (638x479, 28K)

Other urls found in this thread:

stackoverflow.com/questions/29008127/why-are-rust-executables-so-huge
eclipse.org/downloads/packages/
twitter.com/NSFWRedditGif

Just use Go, it has more libs, easier to use, and non shit syntax, and static binaries. It's what Rust trie

As a C fag, you will like neither of C++ or Rust.
Rust is geared towards experienced C++ devs who go sick and tired of C++'s idiosyncrasies. You have to be fully aware of C++ pitfalls to be able to really appreciate what Rust has to offer.

Rust is the better language but currently the less industrially relevant one. Luckily, you can get a CS job without learning C++; do so, and wait a few years until you can make money programming in Rust.

But it has garbage collection, which isn't really something I want to have

lol no generics
lol no sum types

So you;re saying down the line that Rust would be worth learning?

I mean, I obviously can't predict the future, but programmers seem to like it and teams that start rust don't seem to drop it later, so probably.

C++ is a whole different animal compared to C
problem is OOP doesn't play well with manual memory management, try to learn about vectors and smart pointers, then learn about the STL

>That pic
lmao I remember this claim. But it turns out Rust has all the esoteric bullshit of C++ with all the fiddly difficulty of Haskell. The target of safety AND control just made it unwieldy.

this
Rust Syntax is absolute ass
Just learn C++ properly, use smart pointers and rule of 5, dont use new

>Rust Syntax is absolute ass
how can someone say this and in the same breath praise C++ lmao
seriously, where is C++ better than Rust syntaxwise

C++ is fine if you ignore like 90% of it. I'd love to see a C+ language that strips out all the garbage. As it is, working with others in C++ requires a lot of standardizing, code reviews, and beating people up over doing shit they shouldn't be doing.

>I'd love to see a C+ language that strips out all the garbage.
you're in good luck, my friend! such a language exists, and is called Rust

I'm really into Haskell now, with STArrays you can do all you could with C/C++

>strips out all the garbage
>rust

Attached: 1531901835761.png (620x463, 285K)

You guys should all start learning Delphi, its the next big thing.

It won't be. It's a dead end in language design. You can't improve the quality of code by trying to make the language safe. In the first place, it doesn't even work, in the second, you just create new kinds of bugs.

Alternatively just use C. Simple, maps predictably to the assembly of common machines, complete flexibility in approach/toolchain/linking, abundant tooling, compiles very quickly and (obviously) lightning fast at runtime. 46 years, and still nothing has beat it.

Unless you are writing something that is extremely security sensitive, like an SSL library. In that case, you should probably be using Ada. Certainly not flavour-of-the-month silicon valley bullshittery like Rust/Go.

Rule of 5?

This sounds like a good idea. I would believe that it would be a good idea to stop myself from using C code in C++ and attempt to use the new stuff.

In C++, if you give a class a destructor and you want to avoid a myriad of unpredictable problems, you also have to write all of the following for it:
>copy constructor
>move constructor
>copy assignment operator
>move assignment operator
This is exactly as retardedly ass backwards as it sounds and cannot be justified no matter how hard C++ evangelists would like to try.

C++ isn't all that bad, the bad part is that the community around it decides that they all want to reimpliment the standard library their own unique and spechull way.

Also headers and source code files not being synchronized and the verbosity not just being handled automatically.
I mean, I understand the point in it, but fuck, why the hell don't text editors and IDEs offer the option to streamline the fuck out of that shit.

>for command line applications
kek, typical worthless Jow Forums bikeshedder

Nope. Rust bolts on a shitload of annoying crap. I'd much rather use C++ with proofing tools, so I do.

Unironically almost this. Anders Hejlsberg went on to make C#. So close to perfect. Just need that with the ability to do your own memory management.

>annoying crap
must suck being a brainlet huh

Rust is a meme and I hope it flutters away but it will probably become the next big thing regardless.

>, in the second, you just create new kinds of bugs.
[citation needed]

>Needs hand holding to not leak memory or overflow.
must suck being a brainlet huh

Would this graph imply that knowing C++ and Haskell makes you the ultimate programmer?

No, it would imply that knowing both C++ and Haskell makes you about as good as someone who only knows Rust

More like Rust and Haskell.

>use smart pointers and rule of 5
Why would you use smart pointers AND rule of 5? The whole point of smart pointers in C++ is that the type behaviors are supposed to make manual management optional.

Attached: 1301537945739.jpg (404x402, 28K)

>Rust
>Control
LMAO
Good luck with that BC you got there.

useless lang is still useless

>rust syntax is great
>but c++ is shit
at least rust actually does something helpful with its obnoxious syntax

you don't need unsafe if you aren't a lazy cunt

unironically this. if all you're doing is making cli tools, it has great libs for that

rust is owned by thought policing trannies and lesbians my dude

>unsafe stuff clearly marked with a big unsafe flag
It's better than everything being implicitly unsafe. You can actually keep track of which chunks of code are unsafe.

>but what if someone makes the entire project unsafe?
Then they would clearly be too retarded to use C/C++ responsibly.

You don't need an unsafe keyword to know what's safe and unsafe in C. You simply have to model the entire program in your mind like a programmer is supposed to.

That's nice, and true, but only for smaller programs.
Try to fucking model a large scale project in your head, with many different "moving parts".
Good luck.

Attached: 1520368765383.png (110x183, 28K)

Rust is a piece of shit, with autistic documentation run by transqueers.

I would love to see a rust Fag implement a project using modern software engineering constructs using Rust. They'll have to use unsafe everywhere.

Rust isn't only a language it's also a cult ideology.

>what is servo

Are you retarded? The smart pointer will call the destructor, but if your class is poorly made it will let garbage everywhere

>for command line applications
rust hello world is over half a megabyte
that's your baseline for command line applications
no stable abi either

Stick with C.
If you really want another language then do C++. Rust is a mozilla meme.

Go with java. Guaranteed salary.

>that pic
But safety is control. The safety in Haskell is that side-effects are under strict control. I'm not sure how I would call the "control" in that picture though. It's actually about having less strictly modeled side-effects so you can print a line without learning monad transformers but at the same time it means that any function in your program could print a line and the burden of ensuring that it will happen only at the right time is on you.

I think "control" in that case is intended to mean how efficiently you can manipulate the underlying machine.

Just use Python if it's the command line. Or maybe even node

If you statically compiled C you would get the same

Rust uses static linking to compile its programs, meaning that all libraries required by even the a Hello world program will be compiled into your executable.
To force Rust to dynamically link programs, use the command-line arguments -C prefer-dynamic; this will result in a much smaller file size.
A statically compiled Rust hello world is actually smaller than the equivalent C. If you are seeing a huge difference in size, it is probably because you are linking the Rust executable statically and the C one dynamically.
So, if you want to compare apples to apples, you need to make sure either both are dynamic or both are static. Different compilers will have different defaults, so you can't just rely on the compiler defaults to produce the same result.

If you're interested, here are my results:

-rw-r--r-- 1 aij aij 63 Apr 5 14:26 printf.c
-rwxr-xr-x 1 aij aij 6696 Apr 5 14:27 printf.dyn
-rwxr-xr-x 1 aij aij 829344 Apr 5 14:27 printf.static
-rw-r--r-- 1 aij aij 59 Apr 5 14:26 puts.c
-rwxr-xr-x 1 aij aij 6696 Apr 5 14:27 puts.dyn
-rwxr-xr-x 1 aij aij 829344 Apr 5 14:27 puts.static
-rwxr-xr-x 1 aij aij 8712 Apr 5 14:28 rust.dyn
-rw-r--r-- 1 aij aij 46 Apr 5 14:09 rust.rs
-rwxr-xr-x 1 aij aij 661496 Apr 5 14:28 rust.static

These were compiled with gcc (Debian 4.9.2-10) 4.9.2 and rustc 1.0.0-nightly (d17d6e7f1 2015-04-02) (built 2015-04-03), both with default options and with -static for gcc and -C prefer-dynamic for rustc.

I had two versions of the C hello world because I thought using puts() might link in fewer compilation units.

If you want to try reproducing it on Windows, here are the sources I used:

printf.c:

#include
int main() {
printf("Hello, world!\n");
}

puts.c:

#include
int main() {
puts("Hello, world!");
}

rust.rs

fn main() {
println!("Hello, world!");
}
stackoverflow.com/questions/29008127/why-are-rust-executables-so-huge

>no stable abi either
So like C++.

>I don't understand static linking
And these people post in Jow Forums

Only if you're a winfag. C++ implementations on Linux have no issues with ABI stability.

>muh stable abi
C doesn't even have a backwards stable API, worrying about ABI comes later.

>python: command not found
>node
wtf

Just make a binary in go.

C++11 made all previous ABI incompatible by design. It matters not what OS you are on.

>go
I started learning Go,
holy shit the language could be so much better
var randStream = rand.New(rand.NewSource(time.Now().UnixNano()))

func qsort(arr []int) []int {
if len(arr) pivotValue {
bigger = append(bigger, val)
} else {
equal = append(equal, val)
}
}
var result = make([]int, 0, len(arr))
for val := range qsort(smaller) {
result = append(result, val)
}
for val := range equal {
result = append(result, val)
}
for val := range qsort(bigger) {
result = append(result, val)
}
return result
}

$ cat 03.cpp
#include

void foo()
{
puts("Really nigga?");
fflush(stdout);
}
$ cat 11.cpp
void foo();

int main(int, char**)
{
foo();
}
$ g++ -c -std=c++03 03.cpp
$ g++ -c -std=c++11 11.cpp
$ g++ 03.o 11.o
$ ./a.out
Really nigga?

Oh my fucking god.
You do know that people usually use python and bash for cli tools, right?
Go will do just fine.

Now try with GCC

>Go

I'm not really defending go here, it should die in a fire.
it's just that 'go is to bloated for cli tools' is probably the dumbest thing I've read today.

That's libstdc++, not the ABI itself.
As far as I'm aware, GCC since 3.2 has used the Itanium ABI and freestanding code (i.e code which doesn't depend on unstable libraries) should link fine for any version of g++ thereafter.

>autistic
Code for "I'm too dumb.".

Just save yourself all the trouble of learning new paradigms and use Go. If you know C, you basically know Go, all you need to learn is the standard library.

>gcc and ffmpeg are command line
>unarguably the most advanced software that exists

Oh yeah, because surely OP will make something as complex as that.

Use nim?

v1 by 2050?

well it works doesn't it?

>ld: command not found
>libc.so: not found in library path
>linux: command not found
>he needs other programs to run his program

Even sooner than Rust!

Nobody uses rust
As a simple data point on that, look at Eclipse downloads
eclipse.org/downloads/packages/
Eclipse IDE for C/C++ Developers: 84K downloads
Eclipse IDE for Rust Developers: 2K downloads
Why do you care who uses it?
Nobody uses it == no jobs
Indeed.com search for C++, 36K results
Indeed.com search for Rust, 1K results
And the majority of the Rust results have nothing to do with the rust language

And it's not even a good language
Only a fool would invest time learning rust

Don't bother. If he had installed gentoo he would know.

C++ has advanced so much, you can and should treat it as completely different from C, not a step up. Otherwise, you end up writing "C with classes" which is a deprecated and utterly wrong approach.

>he doesn't remember the C++11 ABI shitstorm on Linux distros
Spotted the zoomer.

>eclipse
Please, at least put some effort into your epic trolling.

So by that logic, should we always just use Java forever, just because it's the most popular?

this
choose the right tool for the job

eclipse is still very popular, and I see nothing wrong with it
I was looking around and found the "C+" approach, which I believe you are describing now. I guess I'll just have to unlearn a few things

Leard D

Rust is never the right tool for the job.

Exactly

It replaces C++ in all use cases for C++.

No it doesn't lol.

C++ is a dying language

Attached: tiobe.png (954x475, 61K)

idiot