4 ms·
Show HN: C and C++ preprocessor for modern memory safety
Cdefer A Next-Generation Memory-Safe Preprocessor for C & C++
Bringing modern memory safety and zero-configuration builds to classic C & C++.
- Panzerschrek 1y agoHow memory safety is implemented? Is it even possible with a simple preprocessor tool?
- KrishnaTorque 1y agoRight now there are 3 approaches. The "defer" will free memory when exit scope. Then there is a "try" macro which will handle IO. Then there is macro expansion which will ensure to compile safely. However there are a tons of things to do. It is still in alpha.
- Panzerschrek 1y agoI see no way "defer" may guarantee memory safety. And why is it needed at all in C++, where destructors do similar job of resources freeing?
- tobias12345 1y agoHow will porting a single concept like `defer` from zig, a language that is not memory safe, to C and C++ make those memory safe? `defer` is a poor man's RAII. C++ has had RAII since the beginning, and C++ is still not considered memory safe. So how will adding `defer` help C++ to become memory safe? This feels like another example of how poorly C and C++ devs understand the ideas behind memory safety. You do not really need to understand this concept, as long as you can debug all the memory issues that just pop up:-)