| ▲ | krapht 7 hours ago | ||||||||||||||||||||||
C++: "look at what others must do to mimic a fraction of my power" This is cute, but also I'm baffled as to why you would want to use macros to emulate c++. Nothing is stopping you from writing c-like c++ if that's what you like style wise. | |||||||||||||||||||||||
| ▲ | Qwuke 7 hours ago | parent | next [-] | ||||||||||||||||||||||
It's interesting to me to see how easily you can reach a much safer C without adding _everything_ from C++ as a toy project. I really enjoyed the read! Though yes, you should probably just write C-like C++ at that point, and the result sum types used made me chuckle in that regard because they were added with C++17. This person REALLY wants modern CPP features.. | |||||||||||||||||||||||
| ▲ | loup-vaillant 6 hours ago | parent | prev | next [-] | ||||||||||||||||||||||
> I'm baffled as to why you would want to use macros to emulate c++. I like the power of destructors (auto cleanup) and templates (generic containers). But I also want a language that I can parse. Like, at all. C is pretty easy to parse. Quite a few annoying corner cases, some context sensitive stuff, but still pretty workable. C++ on the other hand? It’s mostly pick a frontend or the highway. | |||||||||||||||||||||||
| |||||||||||||||||||||||
| ▲ | dboon 5 hours ago | parent | prev | next [-] | ||||||||||||||||||||||
No name mangling by default, far simpler toolchain, no dependence on libstdc++, compiles faster, usable with TCC/chibicc (i.e. much more amenable to custom tooling, be it at the level of a lexer, parser, or full compiler). C’s simplicity can be frustrating, but it’s an extremely hackable language thanks to that simplicity. Once you opt in to C++, even nominally, you lose that. | |||||||||||||||||||||||
| ▲ | Lerc 7 hours ago | parent | prev | next [-] | ||||||||||||||||||||||
Perhaps but a project using this stops you from writing any old C++ in your C. Writing C++ in a C style has no such protection. It's choosing which features are allowed in. | |||||||||||||||||||||||
| ▲ | sesm 5 hours ago | parent | prev | next [-] | ||||||||||||||||||||||
Embedded CPU vendors not shipping C++ compilers is what usually stops people. | |||||||||||||||||||||||
| |||||||||||||||||||||||
| ▲ | ikamm 6 hours ago | parent | prev [-] | ||||||||||||||||||||||
>Nothing is stopping you from writing c-like c++ if that's what you like style wise. You'll just have to get used to the C++ community screaming at you that it's the wrong way to write C++ and that you should just use Go or Zig instead | |||||||||||||||||||||||
| |||||||||||||||||||||||