[V4Rb 2] VDatabase.Close

Ruslan Zasukhin sunshine at public.kherson.ua
Wed Jun 1 20:29:10 CDT 2005


On 6/1/05 7:28 PM, "Charles Yeomans" <yeomans at desuetude.com> wrote:

>> What about this:
>> 
>>     db = new ...
>> 
>>         db.open
>>             ...
>>         db.close
>> 
>> 
>>         db.open
>>             ...
>>         db.close
>> 
>> 
>>     db = nil
>> 
>> 
>> As you see each action which allocate resources have pair which
>> deallocate
>> them.
> 
> You could do this; you could just as easily do
> 
> db = new VDatabase
> db.Open
> db = nil
> 
> db = new VDatabase
> db.Open
> db = nil
> 
> db = new VDatabase
> db.Open
> db = nil
> 
> My point is that it is correct behavior for VDatabase.Close to be
> called in the destructor, and it would be a mistake to require the
> developer to call Close explicitly, except say in the example you gave.
 
>   As I am sure you know, the idea of "resource acquisition is
> initialization" is to use destructors to ensure that resources are
> released, and that they are not released while someone is still using
> the object.

Not agree Charles.

Because 

     db = new VDatabase
     db = nil

Work with RAM instance of class Vdatabase.
But Create()/Close() work with file state.

This are 2 quite different operations.

Also I can tell you, that in our C++ sources, we always very carefully split
code which create INSTANCE of class and which do something else. Mixing of
such operations always bring your traps.

-- 
Best regards,

Ruslan Zasukhin
VP Engineering and New Technology
Paradigma Software, Inc

Valentina - Joining Worlds of Information
http://www.paradigmasoft.com

[I feel the need: the need for speed]




More information about the Valentina mailing list