Product Launch
anonymous
5 points
4 comments
Posted3 months agoActive3 months ago
Show HN: C and C++ preprocessor for modern memory safety
github.comC/C++memory safetypreprocessor
Discussion (4 comments)
Showing 4 comments
How memory safety is implemented? Is it even possible with a simple preprocessor tool?
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.
3 months ago
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?
3 months ago
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:-)