new D2.0 + C++ language

Weed resume755 at mail.ru
Fri Mar 20 11:34:45 PDT 2009


BCS пишет:
>>>
>>> I figure unless it save me more times than it costs /all/ the users,
>>> run time cost trumps.
>>>
>> This is a philosophical dispute.
>>
>> A good and frequently used code can be written once and then used 10
>> years in 50 applications in 10000 installations. Here, the costs of
>> programming may be less than the cost of end-user's time and hardware.
>>
> 
> You are agreeing with me.
> 
>>>
>>> As for memory, unless the thing overspends into swap and does so very
>>> quickly (many pages per second) I don't think that matters. This is
>>> because most of the extra will not be part of the resident set so the
>>> OS will start paging it out to keep some free pages. This is
>>> basically free until you have the CPU or HDD locked hard at 100%. The
>>> other half is that the overhead of reference counting and/or the like
>>> will cost in memory (you have to store the count somewhere) and might
>>> also have bad effects regarding cache misses.
>>>
>>
>> Once again I repeat: forget about reference counting - it is only for
>> the debug purposes. I think this addition should be switchable by
>> compiler option.
>>
>> It did not included into the resulting code. Ref-counting needed for
>> multithreaded programs, when there is a risk to get and use a
>> reference to an object that another process has already been killed.
>> This situation needs to be recognized and issued to a run-time error.
> 
> As I understand the concept "reference counting" is a form of GC.

In the proposed language is a way to learn mistake - deleting object in
another thread that still have a reference.

In other words, it is a way to provide proof that the reference refers
to an object rather than the emptiness or garbage.


> It has
> nothing to do with threading. The point is to keep track of how many
> references, in any thread, there are to a dynamic resource and to free
> it when there are no more. Normally (as in if you are not doing things
> wrong) you never release/free/delete a reference counted resource so it
> doesn't even check if it is delete. Also because the count is attached
> to the referenced resource, it can't do that check because the count is
> deleted right along with it.
> 
> For that concept (the only meaning of the term "reference counting" I
> known of) the idea of turning it off for non-debug builds is silly. Are
> you referring to something else?
> 
> 



More information about the Digitalmars-d mailing list