Hacker News new | ask | show | jobs
by pcwalton 4477 days ago
> Modula-2 was created in 1978! Just to cite one memory safe systems programming language.

If you opt into garbage collection for the whole program. That's not the same overhead as C++. (I know you believe that GC is faster than manual memory management, but let's sidestep that debate by defining "the same overhead" as "the same memory management practices that C++ uses, with the same tradeoffs".)

1 comments

Who mentioned GC?

Modula-2 also uses manual memory management just like C.

So by using it, there is a whole class of C errors that are not exploitable:

- Buffer overflows

- Pointers that go astray, injure some critical data structure, only to die minutes later in another totaly unrelated place.

- Strings without null terminator

- No implicit conversions between types

- Proper enumerations

- Arrays are properly bound checked by default (unless explicitly disabled)

Still problems like memory leaks and double free exploits do prevail. However the set of possible exploits is surely smaller than C and C++ offer to hackers.