4 ms·
What are you talking about? The safety you mentioned comes from only two things: type safety and runtime array boundary checks. There is no problem in impleme
by dakimov 13y ago
What are you talking about?
The safety you mentioned comes from only two things: type safety and runtime array boundary checks.
There is no problem in implementing runtime boundary check in C++.
What else in C++ is less safe than in Java? Is there some kind of magic?
- pcwalton 13y agoIterator invalidation, returning references that outlive their referent, storing references in data structures that outlive their referent, invalidation of the "this" pointer, etc.
- dakimov 13y agoBasically those are examples of bare pointer manipulations (as references are essentially syntactically sugared bare pointers). Although it can be mitigated with specially written collections (incompatible with the standard collections) and strict coding guidelines, I have to agree with you that the C++ memory model itself is insanely dangerous.