On Wednesday, 9 January 2013 at 07:23:16 UTC, Walter Bright wrote:
On 1/8/2013 10:55 PM, Mehrdad wrote:
On Tuesday, 8 January 2013 at 22:19:56 UTC, Walter Bright
wrote:
One thing I'd add is that a GC is *required* if you want to
have a language
that guarantees memory safety
Pardon? shared_ptr anyone? You can totally have a language
that only provides
new/delete facilities and which only access to memory through
managed pointers
like shared_ptr... without a GC. I don't see where a GC is
"required" as you say.
Reference counting is a valid form of GC.
C++'s shared_ptr, however, is both optional and allows access
to the underlying raw pointers. Hence, memory safety cannot be
guaranteed.
Right, I never claimed C++ is memory safe.
I just said that a language that does something similar without
giving you raw pointer access is perfectly possible and (short of
memory leaks due to cycles) also perfectly safe.