Navigation
Recherche
|
TrapC proposal to fix C/C++ memory safety
samedi 1 mars 2025, 00:33 , par InfoWorld
TrapC, a fork of the C language, is being developed as a potential solution for memory safety issues that have hindered the C and C++ languages.
TrapC is a proposed C-language extension compiler intended to be implemented as a cybersecurity compiler for C and C++ code, said developer Robin Rowe. “Think of TrapC as wishing C was memory-safe, while also wishing it a bit more like C++, but not so much that it becomes a lot to learn like C++. C code can be safer with C++ constructors and destructors,” said Rowe. “Moreover, C/C++ code should be safe by default, not blunder on after a programmer didn’t check for an error code.” Due by the end of this year, TrapC will be a free, open source compiler similar to Clang and C++, Rowe said. TrapC has pointers that are memory-safe, addressing the memory safety issue with the two languages. With TrapC, developers write in C or C++ and compile in TrapC, for memory safety. TrapC is an extension of the C programming language that removes the keywords goto and union, adds the keywords trap and alias, and adopts a few features from C++ that improve safety such as constructors and destructors, said Rowe. It also provides a couple of new features not in C or C++. Despite being a minimalist programming language with the same number of keywords as C, TrapC has a surprising amount of C++ code compatibility, he said. Rowe presented TrapC at an ISO C meeting this week. Developers can download a TrapC whitepaper and offer Rowe feedback. According to the whitepaper, TrapC’s memory management is automatic and cannot leak memory. Pointers are lifetime-managed, not garbage-collected. Also, TrapC reuses a few code safety features from C++, notably member functions, constructors, destructors, and the new keyword. TrapC is not the only attempt to deal with memory safety in C or C++. The C++ Partnership worked on its Safe C++ Extensions project to remedy C++memory safety. Rowe said that other proposals do not offer the comprehensive memory safety offered by TrapC.
https://www.infoworld.com/article/3836025/trapc-proposal-to-fix-c-c-memory-safety.html
Voir aussi |
56 sources (32 en français)
Date Actuelle
lun. 3 mars - 23:57 CET
|