| ▲ | variadix 2 days ago | ||||||||||||||||||||||||||||||||||
I’ve settled on a dialect of C++ for systems programming after using C for a long time. It’s mostly C-like and I disable exceptions, RTTI, etc. but I do use templates, overloads, methods, lambdas, etc. I have my own object system with constructor methods that all return a status code so you don’t need exceptions, my own stdlib for containers, buffered I/O, networking, hashing, math, threading, async, etc. C++ gives you all the features to effectively build your own language, and you can use first class tooling since C++ is widely supported. LLMs also make it much easier to build out and test an entire stdlib on your own. | |||||||||||||||||||||||||||||||||||
| ▲ | adsharma 2 days ago | parent | next [-] | ||||||||||||||||||||||||||||||||||
The reason why I prefer a GC based compiled language with types vs Rust or Zig is that they put memory allocation front end center in the language. Sometimes I want to think about algorithms and memory management separately.
Try translating to zig.This is why we need natural language -> pseudo code -> GC typed -> Low level systems. Both Zig and Rust are fine as the last stage of this software development pipeline with different trade-offs. Problems arise when people try to use them earlier in the process. | |||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||
| ▲ | jandrewrogers 2 days ago | parent | prev | next [-] | ||||||||||||||||||||||||||||||||||
I've essentially done much the same. One of the more under-rated features of C++ is being able to build a new language environment based on a different set of composable idioms from the low-level primitives on up. C++ is as much a tool for building nice systems DSLs as it is a systems language. The heavy investment in compile-time expressiveness has really paid off for the language over time. | |||||||||||||||||||||||||||||||||||
| ▲ | lilbigdoot 2 days ago | parent | prev | next [-] | ||||||||||||||||||||||||||||||||||
I don't write much C or C++, but I like writing transpilers and got pretty far with an F# to C backend a while ago, and it was pretty difficult for me (granted it was my first codegen project) I tried it again with C++ out of curiosity and C++ is ridiculously featured for making it into your own and little domain languages or something that feels like a new feature. Genuinely kind of awesome for transpilers and it definitely gave some insight to the "C++ is awesome, but you have to pick the 20% of features you like" wisdom I've heard LLMs were fun for exploring C++ patterns as well. I could ask it techniques for approximating some construct in another language and get a full page of toys to try out. It definitely made me want to explore templates in my own language in addition to runtime generics | |||||||||||||||||||||||||||||||||||
| ▲ | faresahmed 2 days ago | parent | prev | next [-] | ||||||||||||||||||||||||||||||||||
Agreed. I'd not ditch the STL completely, but only use its freestanding subset. Implementations contain some very fast SIMD-accelerated code[1]. +The STL works without exceptions. [1]: https://github.com/microsoft/STL/blob/main/stl/src/vector_al... | |||||||||||||||||||||||||||||||||||
| ▲ | pjmlp 2 days ago | parent | prev | next [-] | ||||||||||||||||||||||||||||||||||
This is the way, take what suits your use case, using C++ doesn't mean taking the whole feature list. | |||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||
| ▲ | jimbob45 2 days ago | parent | prev [-] | ||||||||||||||||||||||||||||||||||
What are you using for a build system? | |||||||||||||||||||||||||||||||||||