News for hackers. Stuff that matters.
Re:Show HN: C and C++ preprocessor for modern memory safety by Panzerschrek on Sunday October 19, 2025 @02:14PM (#45636489)
How memory safety is implemented? Is it even possible with a simple preprocessor tool?
Re:Show HN: C and C++ preprocessor for modern memory safety by KrishnaTorque on Sunday October 19, 2025 @04:36PM (#45637715)
Right 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.
Re:Show HN: C and C++ preprocessor for modern memory safety by Panzerschrek on Monday October 20, 2025 @02:01AM (#45640486)
I 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?
Re:Show HN: C and C++ preprocessor for modern memory safety by tobias12345 on Monday October 20, 2025 @06:50AM (#45642445)
How 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:-)