RE: [GD-General] Compile times
Brought to you by:
vexxed72
From: Mick W. <mi...@ne...> - 2002-12-17 18:20:48
|
> -----Original Message----- > From: gam...@li... > [mailto:gam...@li...] On > Behalf Of Thatcher Ulrich > Sent: Tuesday, December 17, 2002 9:32 AM > To: gam...@li... > Subject: Re: [GD-General] Compile times > > > On Dec 16, 2002 at 11:46 -0600, brian hook wrote: > > introducing a degree of non-determinism in my code (smart pointers), > > Note: the behavior of ref-counted smart pointers is > completely deterministic. (That's one of the nice things > about ref-counting, compared to other GC approaches.) > Well, all code is completely deterministic, if you want to get picky. I think what Brian was referring to, is that with re-counted smart pointer, if you "delete" it, then you don't know if the object it points to is going to be actually deleted. So you are writing code where you don't know what it is going to do. Of course, you could actual determine what it is going to do, by adding some more code to check the reference count. But does this make your code deterministic? And is that even something you want the smart pointer to supply an interface to? I fear getting pedantic here. But when you speak of determinism of a thing, then you are referring to the lack of dependency on external factors in contributing to the future state of an object. When you speak of the determinism of code, I understand that as a measure of the extent to which you can predict the behaviour of a piece of code. For example "'delete p' will call the destructor of object *p" vs "'delete p' might call the destructor of the object *p" So, while you could (maybe) say that the behavior of a ref-counted smart pointer is completely deterministic, I think it's a fair comment to say that replacing the usage of a regular pointer with a smart pointer will decrease the amount of determinism in a piece of code (Brian's code, not the smart pointer code), by making it reliant on the actions of other loosely coupled objects about which it knows nothing. Okay, I'll stop now. Sorry. Mick. |