TrapC: A C Extension For the Memory Safety Boogeyman
1 min read
Summary
TrapC is a newly proposed C-language extension from researcher Robin Rowe, that adds several features to the C programming language, primarily around memory safety, with the aim of fixing issues in the C language.
Essentially, it adds several features of the C++ programming language such as constructors and destructors, managed pointers (the method of which is “implementation defined”), run-time type information (RTTI), and “traps” (its mechanism for exception handling).
Additionally, it removes keywords such as “goto” and “union,” because these are “unsafe” and “widely deprecated.”
The author claims that TrapC is “a better C++,” citing its handling of exceptions and templates, albeit with some opaque syntax.
TrapC’s author criticizes Rust for its unsafe keyword, claiming that the language requires developers to “visualize memory,” but does not actually explain how the traps mechanism improves upon Rust’s system.
Later in the article, the author states that memory safety is not actually a significant source of vulnerabilities, and the focus should be on preventing logic errors, and validating user input.