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?
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.
Mason Moore
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.
Easton Rodriguez
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.
Landon Cruz
>this meme thread again
Isaac Hernandez
I like Java.
Brandon Morgan
Java is useful for android development
Adrian Adams
There's Java embedded as well.
Hunter Richardson
The world needs easy to use concurrent languages. Rust provides none of them.
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.
Dominic Flores
>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
Dylan Rodriguez
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.
Jordan Garcia
>every language that isnt C/C++ is implemented in C/C++ Whoever you are quoting is a total computer illiterate
Sebastian Morales
Name one high level language that is not implemented at some level using C++/C
Dylan White
1. C/C++ are high level languages themselves 2. Rust
Austin Scott
Point to me where Java uses C or C++
Juan Diaz
All java virtual machines and bytecode compilers are implemented in C/C++ fool
The rust compiler is made in C/C++
Camden Garcia
rust just uses llvm. which is C++
JVM
Jackson Gonzalez
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...
Lucas Hughes
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
Jack Perez
>move-the-finish-line posting
you never even said "language"
Hunter Morales
The word used was "implementation", which can be interpreted as a compiler or interpreter/VM, depending on the language.
>implement rust binding to llvm >write the rest in rust, interfacing with the rust/wrapped C++ yea dude
Connor Jackson
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++?
Julian Sanchez
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.
Henry Bennett
>le every language is """"implemented"""" in C(ancer)(++)
Is this the latest meme?
Cameron Robinson
offended rust shiller
Aaron Martin
p... please use rust!!!
Lucas Smith
>get rekt >"offended rust shiller" You need to get better at this
Camden Turner
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?
Noah Thomas
That's JDK, not JVM
Grayson Smith
>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
>but all serious languages eventually write a self-hosting compiler. Why? C is implemented in C++. What's wrong with it?
Xavier Baker
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
Wyatt Hall
show me one high level language that is totally untouched by C or C++
Eli Cruz
Haskell, Rust, Ada, Ocaml, Idris, Pascal and the list goes on
Eli Russell
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.
Alexander Ortiz
C is stagnant, too small and does not address memory safety
Elijah Powell
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.
>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?
Lincoln Anderson
LLVM uses Clang and GCC for compilation. Rust only 'compiles' to LLVM IR.
Dominic Taylor
LLVM does not use GCC.
Andrew Gray
#NOTMYCOMPILER
Connor Fisher
Clang uses LLVM for compilation, not the other way around, dumbass
Elijah Ross
>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.
Isaac Robinson
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.
Cooper Turner
How old are you? Honest question.
Dominic Kelly
Your typical C toddler
Mason Mitchell
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
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.
Carter Lopez
Are you having a mental breakdown, C tard?
Asher Harris
Ayy C toddlers rekt
Blake Scott
wtf i hate c now
Kevin Johnson
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.
Joseph Gomez
Excuse me, I have a question
How will C(ucks) ever recover?
Mason Robinson
>hello world in rust takes 11 megabytes
DROPPED
Austin Mitchell
>Rust still has to piggyback on LLVM. What do you mean, re tard C tard?
Logan Powell
>doesnt know what the LLVM is >calls another a retard in the same sentence