manual memory management

Mehrdad wfunction at hotmail.com
Wed Jan 9 01:24:33 PST 2013


On Wednesday, 9 January 2013 at 09:08:40 UTC, Brad Roberts wrote:
> On 1/9/2013 1:00 AM, Jonathan M Davis wrote:
>> On Wednesday, January 09, 2013 09:54:10 Mehrdad wrote:
>>> You (or Walter I guess) are the first person I've seen who 
>>> calls
>>> C++ garbage collected.
>> 
>> I sure wouldn't call that garbage collection - not when 
>> there's no garbage collector. But Walter has certainly called 
>> it that from time to time.
>
> There's a collector, it's in the refcount decrement (a little 
> simplified):
>
> if (refcount == 0)
>    free(obj);
>
> Granted, it's terribly simple, but it's there.

Sure, it's there.

The problem I have with it is that this line of reasoning makes 
no sense of what Walter said, which was:

"A GC is *required* if you want to have a language that 
guarantees memory safety."




No matter how he defines the word GC, I _STILL_ don't see how 
this is true.


I can perfectly well imagine a language which allows you to use 
integers as _handles_ to objects (perfectly _manual_ management 
of _everything_), and which gives you access to their fields via 
external functions.

The language need not give you any direct access to memory, 
making everything perfectly safe.

I really don't think Walter's statement made any sense whatsoever.


More information about the Digitalmars-d mailing list