Settings

Theme

To kill memory safety bugs in C code, try the TrapC fork

theregister.com

2 points by CppPro a year ago · 3 comments

Reader

hammil a year ago

> "Where you see a big difference is TrapC doesn't have malloc. TrapC has new, like C++ does. And so you need to change all your malloc calls. But TrapC doesn't have delete. TrapC does the memory. There's no memory leaks in TrapC because the compiler handles free memory. Also, in that way, it's like Java. Java you call new, but you never call delete."

Word salad aside, how is this achieved? RAII? Some super-secret static analysis? Are some allocation patterns just not allowed?

  • rini17 a year ago

    Yes, let's see how it does something like doubly linked list.

1oooqooq a year ago

this part is almost convincing me he's a dingus

> "And TrapC has the same ABI as C. So if you want to do something unsafe, you can write it in C and link to it. And this is a big difference from Rust where you have the unsafe keyword saying, 'Well, you know, I give up, I'm not going to be safe here.'"

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection