3 ms·
C++ type system allows invalid code (that uses freed or uninitialized memory) to run and just do weird incorrect things.
by pawelmurias 5y ago
C++ type system allows invalid code (that uses freed or uninitialized memory) to run and just do weird incorrect things.
- eru 5y agoSort-of. That code is invalid in some informal sense, but not invalid as far as the formal typesystem is concerned. There's also something about 'soundness' one could say.
- choeger 5y agoSo does every Turing-complete language with non-termination. Type systems are decidable and thus cannot, by definition, rule out all errors. Instead, they look at a subset of possible errors. This subset is provably eliminated from valid code. "Dynamically typed" languages reduce that subset to the empty set.