Just finished reading the Zig cc article and I must say I'm also quite impressed. I'll be keeping an eye on the next Zig release--being able to eventually use it as a `cc` or `mvsc` replacement would be a big game changer. Having recently run the study of trying to cross compile a few C++ and GTK apps, I can really see the appeal.
I don't know of anyone who actually uses Rust in that niche.
Everyone who uses Rust is using it because of "C++ is hard, let's go shopping instead" syndrome.
I.e., at this point it's a language for beginners to ease themselves into programming without training wheels and eventually graduate to real big boy programming languages.
The real-world fact is that Rust is, as of March 2020 at least, an entry-level systems programming language. It's used as a stepping stone by former PHP/Python/Go programmers, who are very intimidated by C++, to get into performance-oriented coding.
Nobody actually writing embedded or sensitive code (airplanes, nuclear power stations, etc.) is doing it in Rust.
The language is young and you don't certify a software solution every two days or don't rewrite your nuclear power station code every day.
Very experienced programmers switched to Rust because it makes it possible to build large scale industrial programs both efficient and reliable. They won't switch to C++ just because they think they're good enough to live dangerously.
(btw I work on plant control and yes I write parts in Rust)
This never happens in the real world; not unless the 'very experienced' bit is experience only in languages like PHP or Python.
It's true that not a lot of people are using Rust for embedded software. That's a much harder nut to crack because so many of the toolchains are proprietary (and embedded support in Rust is still missing quite a few things).
You kind of do if you ever want to work on anything other than pet personal one-man projects.
Also: I've used Rust at work. In fact, I learnt Rust because I was processing a lot of data at work, and needed a fast language to do so in a reasonable amount of time.
Rust seems to be mostly something "full stack developers" and "back end developers" embrace for server-side toys and hobby projects.
Top-end embedded processors have GPUs and hypervisors these days and run AI algorithms to, say, detect lane changes and do parallel-parking maneuvers. These days AI means code written in Python and Fortran.
Still no way to catch use-after-free.
fn add(a: i32, b: i32) i32 {
return a + b;
}Rust quickly becomes harder though, while Zig is much easier to grasp.
But then, of course, it wouldn't have much to do with Zig's "appeal as better C than C", which prompted this whole discussion.
char * const (*(* const bar)[5])(int )
And its translation: declare bar as const pointer to array 5 of pointer to function (int) returning const pointer to char
This seems like what I'd get from the spiral technique. int** arr1_of_arr2_of_arr3_of_ptr_to_ptr_to_int[1][2][3]
In this case, spiraling between [1], ×, [2], ×, [3], int is obviously wrong, the correct reading order is [1], [2], [3], ×, ×, int. (Edit: read × = *)The Right-Left Rule is quoted less frequently on HN but it's a correct algorithm for deciphering C types: http://cseweb.ucsd.edu/~ricko/rt_lt.rule.html
The only thing that C has taken from Algol, was structured control and data.