3 ms·
Undefined behaviour is great. I for one will continue to vote in its favour. C++ does not add runtime overhead to validate that programs are well-formed.
by mgaunard 4y ago
Undefined behaviour is great. I for one will continue to vote in its favour.
C++ does not add runtime overhead to validate that programs are well-formed.
- staticassertion 4y ago> C++ does not add runtime overhead to validate that programs are well-formed. You have succinctly described the problem.
- mgaunard 4y agoThat's not a problem, that's a core policy of that language's design. If you want a language that is slow, there are plenty of options.
- olliej 4y agoCan you provide examples of UB that could be unspecified behaviour, where UB does anything other than cause harm?
- mgaunard 4y agoDereferencing a pointer to memory that doesn't point to a live valid object is undefined behaviour. You couldn't possibly specify what this does without instrumenting every single access to memory, like asan or valgrind does.
- olliej 4y agoAs I said, behaviour that could be unspecified rather than undefined. This is an example of something that cannot be anything other than UB.
- kllrnohj 4y agohttps://www.youtube.com/watch?v=yG1OZ69H_-o https://www.youtube.com/watch?v=yG1OZ69H_-o is a great talk on this