Do you think it's worth spending time studying the C programming language today, considering that #Rust addresses and improves upon many of the fundamental issues found in #C and #cplusplus?? Why?
@lobocode depends entirely on what you seek to gain from it.
C can be helpful in understanding low level concepts much more than Rust, which while comparable wrt. performance is a much more high level language (most of the time)
@laund Does it make sense to start new projects in Rust instead of C/C++ and to use C/C++ only to support existing projects? Or depends?
@lobocode for me personally? Yes.
Rust feels like a well rounded language, where many features are effects of the few truly intrinsic concepts it has. It also feels much more like a high level language, with lots of things built in and a great dependency management. I'm much more productive.
i recommend https://youtu.be/6D8WVYm1YwY for a interesting comparison, where he follows the "ray tracing in a weekend" C++ book in Rust. especially the earlier parts are a good example of the differences.
@kornel @lobocode @laund I would even go that far and call C and C++ legacy. If you have the time, learn them as if you are visiting a museum to better understand the present and future after studying the history.
Try to do some multi-threading for example and watch for data races and segfaults.
I don't regret attending the lecture about parallel programming in C++ and even recommend it to people knowing Rust. Because it gives you a much better understanding of what Rust prevents and improves.
@mo8it @kornel @laund Considering the C++ community's current state, I have reservations about the legacy perspective you mentioned. For instance, you can see this concern addressed in the following document: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/p2759r0.pdf. In this document, there is a focus on rectifying issues in C++ and addressing the over-improvements found in Rust ++
@mo8it @kornel @laund However, I cannot ignore certain behaviours, such as the one described in this article: https://security.googleblog.com/2022/12/memory-safe-languages-in-android-13.html?m=1
@lobocode @mo8it @laund This is the desired direction, but proponents of carbon/cpp2/cppfront will tell you that C++ suffers from bad defaults in basic features, and can't fix them without a widespread compatibility break that makes it almost a new language. If you're going to do a major rewrite old C++ to new C++, you may as well get even more things fixed.
@lobocode @mo8it @laund A recent talk on this: https://youtu.be/lgivCGdmFrw?t=916 showing that C++ can patch flaws in individual features, but can't take a major step back to e.g. forbid mutable pointer aliasing.
@lobocode @mo8it @kornel i remember that document being torn apart when it came out, even in pro-C++ spaces.
its links to "vulnerabilities" in Rust which are: a 3rd party package, a typosquat, and a performance issue in regex. (they could just look at the unsound tag...)
it also implies that C++is seen as less safe becuause it doesnt advertise safety.
also says Rust was originally "built on top of" C++ - it wasn't. the first compiler was written in OCaml then selfhosted
not very trustworthy
@lobocode For the things I'm familiar with (the Linux ecosystem) libraries are traditionally in C, so even in Rust, understanding of C is relevant when you need to write bindings for a library, look at its code to understand it / diagnose a bug, contribute to things you depend on, etc. C++ meanwhile is just not really used in core libraries in the Linux ecosystem (outside Qt/KDE), but is ubiquitous in other spaces.
Understanding of C helps to motivate Rust, but hopefully isn't necessary.
As of June 2023 have been writing software professionally for 30 years.
My entire working career I've been hearing that C is going to be obsolete.
Today, everything important is written in C.
@lobocode well, if 'what exactly is going on' is more important than 'want to do a practical project' or ' want to get a job', then assembly is also a good choice. A good programmer needs to be comfortable with at least one layer above and below the target layer, so understanding of assembly would certainly improve ones understanding of rust/c/c++/whatever.
@lobocode
I'm not familiar with the current state of rust in this area, but I remember people saying that C was still prevalent in embedded systems, and rust was nowhere near.
If this is something you're planning to go into, maybe you should consider.
@lobocode There's a *lot* of existing and valuable code in production written in C and C++. The product I work on was released 30 years ago, has 3 generations of programmers and software engineers working on it, and makes huge profits.
Even if you only intend to ever write programs in Rust, you will frequently need to be able to read and understand programs written in C and C++ during a career in software development.
@lobocode In addition to the large amounts of legacy code others have already mentioned,
a) The C ABI is basically the lingual franca of FFI (i.e. when one programming language calls into code written in another, they often provide C interfaces to talk to each other)
b) Learning C++ will make it clear why some of the weird parts of Rust are that way and how they are better.
@lobocode I like how low-level C is. It is quite good and fun for learning the fundamentals of system programming, and it makes you appreciate Rust later on.