Re:CppCMS – High Performance C++ Web Framework
by dakimov on Saturday July 06, 2013 @05:01AM
(#5998375)
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?
Re:CppCMS – High Performance C++ Web Framework
by pcwalton on Saturday July 06, 2013 @01:19PM
(#5999380)
Iterator invalidation, returning references that outlive their referent, storing references in data structures that outlive their referent, invalidation of the "this" pointer, etc.
Re:CppCMS – High Performance C++ Web Framework
by dakimov on Sunday July 07, 2013 @11:30AM
(#6002245)
Basically 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.
This is a belief that many C++ programmers have, and having spent much of my life in the past few years finding ways to break a C++-like memory model (Rust) I cannot emphasize enough how dangerously wrong it is. Safer than C, sure. As safe as a memory-safe language like Java, absolutely not.