4 ms·
I completely do not understand why the author thinks Rust is a C replacement. I can understand Rust as a C++ replacement. If he was looking for a better C, Zig
by pharrington 5y ago
I completely do not understand why the author thinks Rust is a C replacement. I can understand Rust as a C++ replacement.
If he was looking for a better C, Zig definitely fits the bill.
- richardanaya 5y agoProbably has something to do with Rust being used in embedded and kernel operating systems due to it's high level of memory control and zero runtime capabilities.
- Zababa 5y agoRust is already used as a C replacement in some cases. However, as I said (https://news.ycombinator.com/item?id=28094998 https://news.ycombinator.com/item?id=28094998), just talking about a C replacement without mentionning why you were using C in the first place and what you value in a replacement isn't really productive.
- pjmlp 5y agoRust needs decades to catch up with domains that C++ has managed to keep for itself, like GPGPU, GUI composition engines, machine learning, HPC. The other domains where C++ was strong for general purpose applications have been taken over by managed compiled languages like Java and .NET, which anyway make use of C++ libraries alongside their AOT/JIT compiled stacks. There is little value to add from Rust in such scenarios, e.g. it won't make my WinUI application, CUDA shader or weather simulation model, any more safer than they already are.
- andi999 5y agoC++ for gpgpu was more of an afterthought in nvcc, wasn't it. I would be surprised if not most cuda kernels are written in plain C.
- pjmlp 5y agoNot at all, it was one of the reasons why OpenCL lost, by staying too long focused on C. CUDA supports C++ since version 3.0, and NVidia designs the cards to follow C++ semantics, regardless of the polyglot capabilities from PTX. Hardly an afterthought, it was Khronos that became surprised that most researchers don't want to use plain old C on their research efforts.
- andi999 5y agoGood to know. Do you have further reading material on this?
- pjmlp 5y agoSure, "CppCon 2016: “Bringing Clang and C++ to GPUs: An Open-Source, CUDA-Compatible GPU C++ Compiler" https://www.youtube.com/watch?v=KHa-OSrZPGo https://www.youtube.com/watch?v=KHa-OSrZPGo "CppCon 2019: Olivier Giroux “The One-Decade Task: Putting std::atomic in CUDA.”" https://www.youtube.com/watch?v=VogqOscJYvk https://www.youtube.com/watch?v=VogqOscJYvk "Octane render. The Future of GPU Rendering: Real-Time Raytracing" (with CUDA) https://www.youtube.com/watch?v=wGTIGjgXs6M https://www.youtube.com/watch?v=wGTIGjgXs6M NVIDIA HPC SDK https://developer.nvidia.com/hpc-sdk https://developer.nvidia.com/hpc-sdk
- masklinn 5y agoRust is a C replacement not in the "tactical" sense of "I like C but it's a bit shit", it's a C replacement in the "strategic" sense: it aims to displace C in most of its core usages e.g. writing low-level or portable libraries, CLI utilities, daemons, kernel and kernel modules, etc… places where only C (and C++ somewhat more debatably) would be an option and continuously causes issues. It also aims to displace C++ when that's used in the same space, but in the sense that that's ground C++ gained from C, well C is the real target, if it can displace C there it can quite naturally displace C++ as well.