V4RB2, CHG, ValentinaInit()

Charles Yeomans yeomans at desuetude.com
Mon Mar 1 15:03:09 CST 2004


On Mar 1, 2004, at 1:57 PM, Ruslan Zasukhin wrote:

> on 3/1/04 8:53 PM, Charles Yeomans at yeomans at desuetude.com wrote:
>
>>> ValentinaIit() now returns the actual size of cache that Valentina 
>>> have
>>> allocate.
>>>
>>>
>>> NOTE: for modern OS that have virtual file system, even if you ask
>>> 100MB for
>>> cache, OS can satisfy your request. But Valentina self can decide 
>>> that
>>> you
>>> ask too big cache size and allocate smaller cache.
>>>
>>> In case of any problems, ValentinaInit() will return ZERO.
>>>
>>
>> Again, why return this value?  This is old C-style design.  Instead,
>> why not have a separate function ValentinaCacheSize() as Integer?
>
> 1) ValentinaInit() can fail.

This is what exceptions are for.
>
>     if return nothing, then you need ask ValentinaError
>     and we need add one more error code.
>
> 2) it can allocate less than you ask.
>
>     one more function...
>
>
> One return value solve 2 tasks at once.

And this is what I'm complaining about.  I think that it's simpler to 
have two things (functions, properties, etc), each of which solves one 
task.

Charles Yeomans



More information about the Valentina mailing list