On 03/16/14 18:36, Dimitry Sibiryakov wrote:
>     Hello, All.
>
>     Can someone explain me why Y-classes use strange tricks with 
> YEntry.next() instead of
> direct calls to real interfaces returned by chosen provider?

Copying next pointer to local (on stack) reference pointer helps to 
avoid risk of destroying an object from another thread and nullifying a 
pointer during operation.

>     Also juggling with NextTransaction in YStatement is very confusing.

See comment in
YTransaction* YAttachment::getTransaction(IStatus* status, ITransaction* 
tra)


     // If validation is successfull, this means that this attachment 
and valid transaction
     // use same provider. I.e. the following cast is safe.

ITransaction is often passed as a parameter in functions of IAttachment 
/ IStatement. Std way of resolving virtual interfaces does not work in 
this case. I.e. we have a risk that due to application bug wrong 
transaction (from other provider) is passed by user uncontrolled at 
compile time. Therefore getNextTransaction and getTransaction are needed.

>     Code contain no comments. Is it really hard when you make a decision to 
> describe why
> you choose this way, what alternatives you considered and why they wouldn't 
> work in your
> opinion?..
>

I always write comments in a places that appear not trivial to me - see 
getTransaction above.


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to