this post was submitted on 18 Jun 2023
8 points (100.0% liked)
Programming
13373 readers
1 users here now
All things programming and coding related. Subcommunity of Technology.
This community's icon was made by Aaron Schneider, under the CC-BY-NC-SA 4.0 license.
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
The main reason why one would want to use C is likely Foreign Function Interface (FFI), whatever code you write in C (apart from emitting assemblies) would likely be usable and extensible from any other programming languages so long that some of the conventions are followed. Rust and C++ could likely produce code just as fast as well optimized C code, but inaccessible or not readily accessible to other programming languages IE Name Mangling that are compiler implementation dependent, missing FFI access to STL and Traits and so forth.
FFI is pretty much the only reason why I am still writing in C in a very large project like GUI Toolkit to replace GTK and QT by using Vulkan. I would not recommend doing what I do when it come to implementing OOP manually in C to ensure that other programming language could extend my library. (I would write VTable manually and establish some of the OOP paradigms. C compiler does extremely well when optimizing out virtual dispatches to static dispatch.)
That's about it, as you said, it have a lot of hassles in C, so that why I am now working on Compiler Generator to create dialects on top of C similarly to MLIR so it would compile to readable C at the end of it as well as generating LSP server, FFI-JSON, and other things for it.