Will C/C++ ever Rust away?

Since the 1970’s C (and later its derivatives like C++) have become the main programming languages used in systems and platform programming, but is that about to change?

C/C++ came to dominate over other languages because it exceeds the 80/20 rule; with well written C/C++ you can get well over 80% of the efficiency of hand crafted assembly language in less than 20% of the development time. However every C/C++ programmer has seen their ‘perfectly’ crafted and tested program crash at the most embarrassing time possible, due to some unexpected issue in memory allocation or mishandling of a pointer.

So is there an alternative that can reduce this? An alternative that might relegate C/C++ to very limited areas of the industry, in the same way as we see assembly language used today? We have seen many new languages pass by without really displacing C/C++ as the systems programming language, but is it possible that Rust might be the real giant killer?

Other urls found in this thread:

doc.rust-lang.org/book/concurrency.html
github.com/rust-lang/cargo/tree/master/src/cargo/core
github.com/rust-lang/rust/tree/master/src
github.com/rust-lang/rust/tree/master/src/librustc
github.com/rust-lang/rust/tree/master/src/rustc
hg.openjdk.java.net/jdk7/jdk7/hotspot/file/tip/src/share/vm/prims/jvm.cpp
en.wikipedia.org/wiki/Glasgow_Haskell_Compiler
en.wikipedia.org/wiki/OCaml
en.wikipedia.org/wiki/Ada_(programming_language)
lmgtfy.com/?q=llvm
en.wikipedia.org/wiki/Bootstrapping_(compilers)
twitter.com/AnonBabble

ctd
Before trying to answer this question we need to understand a little of what the Rust programming language actually is.

Rust is designed to be a ‘safe, concurrent, practical language’ and it is supported by an open (and friendly) community. Rust is sponsored by Mozilla Research, so it has a strong backer and it is unlikely to disappear through lack of support. We at Cambridge Consultants have been working with Rust for a little while, and indeed my colleague Jonathan Pallant gave a positive talk on it in October of last year.

The initial Rust development started back in 2009, with the first stable release appearing in 2015, and a number of updates are released each year. Rust provides a number of high level constructs found in many scripting languages, but it is statically typed and compiled so it can execute as fast as any native language.

As a programmer, who sometimes still uses assembly code to get that extra speed, I have to admit that I was sceptical; you simply can’t use a ‘safe’ language in some areas of system programming. However when I started looking at Rust I found this language design philosophy was applied in a very practical way; what Rust means by ‘safe’ is that the default behaviour is the safe option, but still the programmer has the power to override this where it is necessary.

A trivial example of this is that in C/C++ all variables are mutable by default and you add the const keyword to make them immutable; in Rust all variables are immutable, and you add the mut keyword to make them mutable. The C/C++ programmer in me says that’s a lot more typing, but actually it’s just a small example of a different, safer mind set which you find in the Rust language design. This goes on to having a language keyword – ‘unsafe’; which tells the compiler to release some restrictions in that specific block of code. This keyword also flags areas of the program which need to be checked in more detail during code review and testing; something which is normally achieved by comments in C/C++.

Another area where Rust is helpful is that it handles underlying memory allocation and release of objects, and ensures this is done in a safe consistent way. Again, when I originally saw this I was sceptical, since most languages do this with garbage collectors which cause issues in real time systems. Rust is designed to use reference counting and scoping to implement this in the same way as we would in C/C++. However because it’s part of the language, the compiler can check and catch a number of issues at compile time, rather than finding them from the core dump.

In such a few words I can only start to scratch the surface of the language, and I haven’t even started to describe the infrastructure (such as the package manager Cargo), but I hope I’m sharing a little of the exciting possibilities that this new language might open up.

The Rust language looks like it has a good design, based on looking at the real work of system programmers, and then providing a set of tools in the language to implement code in a safe way. Rust has passed the first hurdle of being able to build its own compiler, and there is work on using Rust on embedded devices, which is starting to show an interesting potential.

However these are very early days, and Rust has a way to go. For example, the ability of Rust to be used to write an operating system or a complex application for the smallest of devices currently supported by C, is yet to be proven. It’s only when Rust is used in anger in such applications that we can truly understand both the full extent of its potential, and its limitations.

Having watched the rise of C/C++, it seems to me that Rust is currently in the position that C was in during the early 1980’s. At that stage the only ‘specification’ available was ‘The C Programming Language’ by Brian Kernighan and Dennis Ritchie, which had been published in 1978. While C was widely used, the formal industry acceptance was only confirmed by the publication of the C89 standard, more than a decade after that first informal specification.

>this meme thread again

I like Java.

Java is useful for android development

There's Java embedded as well.

The world needs easy to use concurrent languages. Rust provides none of them.

Yes you are wrong
doc.rust-lang.org/book/concurrency.html

You really just wrote this right now?

I never said Rust didn't have concurrency support. Rust has poor concurrency support: no green threads and poor support for CSP. Those two are crucial nowadays.

>every language that isnt C/C++ is implemented in C/C++

C/C++ arent going to be dying any time soon considering the fact that literally every other language is implemented in it

Once you have a full Unix-compatible OS written entirely in Rust and it takes over the server and embedded devices markets and completely pushes the BSDs and Linux and OS X and iOS and everything else in the market written in C out, we can talk.

There's no "case" until then, you have to make the killer app and it's a Unix.

>every language that isnt C/C++ is implemented in C/C++
Whoever you are quoting is a total computer illiterate

Name one high level language that is not implemented at some level using C++/C

1. C/C++ are high level languages themselves
2. Rust

Point to me where Java uses C or C++

All java virtual machines and bytecode compilers are implemented in C/C++ fool

The rust compiler is made in C/C++

rust just uses llvm. which is C++

JVM

1. The languages are called C and C++. They are two separate and distinct languages; please do not refer to them as C/C++. C++ is not even a proper superset of C, and with new releases of each language, they are growing far apart.

2. Default immutability is not a good thing.

3. C++ has been doing RAII long before Rust has. Don't go bragging about it like it's some unique language feature of Rust. It's a nice feature, but it isn't a point over C++.

They already have a Unix OS written in Rust called Redox. It hasn't taken over anything yet, since those markets are saturated. There isn't a reason to switch from Linux to anything else.

Pretty much every language not dependent on a virtual machine uses a self-hosted compiler. Haskell's compiler is written in Haskell and compiles to machine code. The same is true for Go, D, Ada, Rust...

I said language, not compiler. Rust has a compiler written in OCaml as well. The RustC is written in Rust. LLVM has been forked by them.

By your logic C is written in C++, since both GCC and LLVM is written in C++, not C

>move-the-finish-line posting

you never even said "language"

The word used was "implementation", which can be interpreted as a compiler or interpreter/VM, depending on the language.

How does it feel to prove yourself retarded?
github.com/rust-lang/cargo/tree/master/src/cargo/core
github.com/rust-lang/rust/tree/master/src

github.com/rust-lang/rust/tree/master/src/librustc

>C is implemented in C++
Good to know

github.com/rust-lang/rust/tree/master/src/rustc

>implement rust binding to llvm
>write the rest in rust, interfacing with the rust/wrapped C++
yea dude

Rust compiles to LLVM IR. LLVM is written in C++, Not the Rust language.

And as I said before, Rust has an OCaml compiler too, does it mean Rust is ""implemented"" in OCaml and C++?

C will not be replaced until Unix and all its derivatives are replaced. The OS and the language reinforce each other. All Unix system calls are defined in C, so systems programming necessitates knowing C. This means C is the common language of all systems programmers, so it is socially easiest for any project with more than half a dozen developers.

This is a stupid meme that means as much as pointing out how the original C compilers were written in assembly.

Yes these languages were originally written in C, but all serious languages eventually write a self-hosting compiler.

>le every language is """"implemented"""" in C(ancer)(++)

Is this the latest meme?

offended rust shiller

p... please use rust!!!

>get rekt
>"offended rust shiller"
You need to get better at this

you realize that the language shown on the repo listing is just the most-used and does not show the actual percentages. which show that they are just java/rust rapped C or C++.
You really think a Java VM just runs on another Java VM and so on forever?

That's JDK, not JVM

>java standard library made in java
nice one dude
Every context that runs your javacode is on a C++ made VM.
Beyond the VM java is just syntax and bytecode specifications

hg.openjdk.java.net/jdk7/jdk7/hotspot/file/tip/src/share/vm/prims/jvm.cpp

...

>but all serious languages eventually write a self-hosting compiler.
Why? C is implemented in C++. What's wrong with it?

what do you think the C++ standard library is made in. Assembly?
Of course a java library is made in java.
Java itself is implemented and actualized in C or C++ based software

show me one high level language that is totally untouched by C or C++

Haskell, Rust, Ada, Ocaml, Idris, Pascal and the list goes on

Rust is nice, but when is this grand exodus going to happen? Also, what's wrong with C? It's a damn fine language even after all this time.

C is stagnant, too small and does not address memory safety

None of these languages are untouched by C++ or C

Rust has so much C and C++ in its implementations and so do Haskell and ada and so forth

most of which drag in C/C++ libraries and just wrap over them the rest of the way.

try again

>Haskell
>Untouched by C or C++
en.wikipedia.org/wiki/Glasgow_Haskell_Compiler

That's a compiler, not a language. Are you dense?

>OCaml
>Untouched by C or C++
en.wikipedia.org/wiki/OCaml

Rust's /src has nothing written in C

>Ada
>Untouched by C or C++
en.wikipedia.org/wiki/Ada_(programming_language)

kek the desperation

...

Even the haskell standard definition mentions C, even if it's pretty well contained.

What desperation?
github.com/rust-lang/rust/tree/master/src

There is not one language that has not has its virginity taken by C or C++ within its core implementation.

Except BrainFuck.

>stagnant
C is not water.

C is stone.

Compiler is not the same as the language. You can write any compiler in any language

C is cancer

>Pretty much every leading implementation of today's high level programming languages are made in C and/or C++

>Hipsters using these languages feel so betrayed that they resort to "RIGGED" desperation such as

>The rust evangelism strike force loses its ringer

P-PLEASE USE RUST

yeah, they're not the same, but the language doesn't do shit without an implementation you dumb fuck

I accept your defeat, user

ITS NOT FAIR

C/C++ BULLS FUCK OFF

Again, you can write any compiler for any fucking language in any fucking language. Language is not the same as the compiler you fucking dipshit

You have to be 18 to post here

>implements python in jython
>java vm is C++

>implements brainfuck interpreter in python
>cython uses C
>uses jython
>java vm uses C and C++

>implement javascript in ruby
>ruby VM and compiler in C

>implement brainfuck interpreter in rust
>rust compiler involves C code and C++ LLVM

Well a language can be defined without ever writing a line of code. This discussion is meaningless if we're not discussing implementation.

tell me you retarded cunt

how are you supposed to run a language you don't have a compiler for?

THERE IS NO ESCAPE FROM THE C

>C.ucks getting BTFO
Everytime

H-HOW DO I ESCAPE C

WHAT LANGUAGE IS PURE

Languages are not executable you computer illiterate fucktard. How can you run a language?

Rust has multiple compilers

all of which have had their virginity taken by C and/or C++

What if I write C compiler in B?

Rust has no compilers. It piggybacks on LLVM.

And?

THERE IS NO ESCAPE FROM C OR C++

Rust has no compilers? What is LLVM?

don't avoid the question you stupid fuck

and you're calling sb illiterate but you can't understand that running a language means running code written in that language.

oh, so bootstrapping's the answer? nice. What language did you use to run the bootstrap? come on, say it out loud.

R U S T
U
S
T

lmgtfy.com/?q=llvm

>Codes "run"
Codes are not executable you toddler. Codes are compiled into machine codes. It's called a compiler. Fuck off, why are you here?

LLVM uses Clang and GCC for compilation. Rust only 'compiles' to LLVM IR.

LLVM does not use GCC.

#NOTMYCOMPILER

Clang uses LLVM for compilation, not the other way around, dumbass

>LLVM uses Clang and GCC for compilation. Rust only 'compiles' to LLVM IR.
That's just plain wrong
GCC and LLVM don't have any direct interaction.
And Clang uses LLVM to compile (it's the C frontend for llvm) not the other way around.

C/C++ isn't a language.
C is a language.
C++ is a language.
Their syntax is similar, but they are not the same language.
The problems with one language is usually not the same for the other.
Change takes time.
You don't see big projects change the programming language, because that is a lot of work, usually for no reason.
Changing from one api to another is a huge ordeal, stuff like upgrading major version on a dependency is really painful.
Best case, you will get some new projects to use a new language.

But change is painful, nobody wants to do it and it is always possible to have bugs in an application.

How old are you? Honest question.

Your typical C toddler

don't make yourself look more like an idiot by trying to correct my terrible grammer, I know that you stupif dumbass. Also, there is no fucking difference if the code's compiled when we're talking about what to implement the compiler for the language in

also, asnswer the fucking question nce and for all

en.wikipedia.org/wiki/Bootstrapping_(compilers)
>llvm is written in C/C++
>llvm has to be compiled to be used

>this thread

C is a disservice to intelligent programmers. It has almost 0 features that a modern and intelligent programmer uses to be productive. Since C is such a timesink, it's popularity is falling more than any other languages in the market.
C is dying and it should die ASAP. C programmers are actually retards in general. C is a small language to grasp, exactly the kind of shit that makes things retard friendly.
C has no advanced features like C++ does.

But as a newfag you are kinda in the right direction. C is for newbies. Think of it this way:
During ancient times, counting to 10 was a big deal and a person who could count to 10 was considered to be "wise".

Fast forward a few century counting to 10 is so trivial we teach this to toddlers. Now toddlers appreciate the vast "knowledge" of counting to 10 while matured brains are busy with modern technologies.

C is from stone age and the people who still preach it is like overgrown toddlers that can't learn advanced things.
C doesn't have delegates
C doesn't have resizable arrays
C doesn't have strings
C doesn't have string concatenation
C doesn't have namespaces
C doesn't have exception handling
C doesn't have closures in the standard
C doesn't have unit tests
C doesn't have Function overloading
C doesn't have memory safety of any kind
C doesn't prevent memory exploits and has no bounds and runtime checks
C doesn't have dynamic method loading/creatin
C doesn't even have generics and templates
C doesn't have meta programming
C doesn't have mixins
C doesn't have higher order functions
C doesn't have contract programming
C doesn't have inner classes
C doesn't have function literals
C doesn't have array slicing
C has a very limited support for implicit parallelism
C doesn't even have string switches

C is a cancer that plagues the modern software industry. If you want guaranteed memory exploits and security vulnerabilities in your program with timesink development period then use Assembly, not C.

Are you having a mental breakdown, C tard?

Ayy C toddlers rekt

wtf i hate c now

Whoops, you're right. The Rust compiler generates LLVM IR for LLVM to compile. Clang is just another front end.
My point still stands: Rust still has to piggyback on LLVM.

Excuse me, I have a question


How will C(ucks) ever recover?

>hello world in rust takes 11 megabytes

DROPPED

>Rust still has to piggyback on LLVM.
What do you mean, re tard C tard?

>doesnt know what the LLVM is
>calls another a retard in the same sentence