Re: [fpc-devel] RFC: customvariant handling in variants.pp and fmtbcd.pp

2011-04-14 Thread LacaK
Could I ask why is there needed VarDataInit ? (only for my interest ;-)) A good question. Formally it is not needed, but in general initializing variables before use remains a good idea. Here the TVarData is passed to VarDataCastTo, and after initializing we can be sure that VarDataCastTo wo

Re: [fpc-devel] RFC: customvariant handling in variants.pp and fmtbcd.pp

2011-04-14 Thread Sergei Gorelkin
15.04.2011 9:20, LacaK пишет: Hi Sergei, Sorry for the delay, got stuck with other issues... Applied in r17319. Thank you for the patch! It is ok ;-) Thanks. Could I ask why is there needed VarDataInit ? (only for my interest ;-)) A good question. Formally it is not needed, but in general i

Re: [fpc-devel] RFC: customvariant handling in variants.pp and fmtbcd.pp

2011-04-14 Thread LacaK
Hi Sergei, Sorry for the delay, got stuck with other issues... Applied in r17319. Thank you for the patch! It is ok ;-) Thanks. Could I ask why is there needed VarDataInit ? (only for my interest ;-)) Laco. ___ fpc-devel maillist - fpc-devel@list

Re: [fpc-devel] RFC: customvariant handling in variants.pp and fmtbcd.pp

2011-04-14 Thread Sergei Gorelkin
12.04.2011 16:18, LacaK пишет: I have attached minor "rearangement", consider them please Will do. It's possible to go even further and completely exclude finalization and try..finally block, because the intermediate Variant is always of type Double, which doesn't need finalization. See pl

Re: [fpc-devel] RFC: customvariant handling in variants.pp and fmtbcd.pp

2011-04-12 Thread LacaK
I have attached minor "rearangement", consider them please Will do. It's possible to go even further and completely exclude finalization and try..finally block, because the intermediate Variant is always of type Double, which doesn't need finalization. See please attached patch if is it L.

Re: [fpc-devel] RFC: customvariant handling in variants.pp and fmtbcd.pp

2011-03-28 Thread LacaK
I have attached minor "rearangement", consider them please Will do. It's possible to go even further and completely exclude finalization and try..finally block, because the intermediate Variant is always of type Double, which doesn't need finalization. Thanks! I will look forward for you

Re: [fpc-devel] RFC: customvariant handling in variants.pp and fmtbcd.pp

2011-03-27 Thread Sergei Gorelkin
LacaK пишет: I have attached minor "rearangement", consider them please Will do. It's possible to go even further and completely exclude finalization and try..finally block, because the intermediate Variant is always of type Double, which doesn't need finalization. I have looked again at f

Re: [fpc-devel] RFC: customvariant handling in variants.pp and fmtbcd.pp

2011-03-23 Thread LacaK
Hi Sergei, Doing what you propose isn't good. Checking for custom variant type is expensive because it involves locking, therefore custom variant handling should be done *after* the standard types. Both committed in r17170, with some changes: great thanks! In fmtbcd.pp, I used VarDataFromStr

Re: [fpc-devel] RFC: customvariant handling in variants.pp and fmtbcd.pp

2011-03-23 Thread Sergei Gorelkin
LacaK пишет: Hi Sergei, I can fix it by following fixs: 1. fmtbcd_castto.diff ... added case when castto varString is requested ... then do not use cast throught varDouble (to avoid lost of precision), but convert directly from TBCD to string 2. variants.pp ... here we must add handling of

Re: [fpc-devel] RFC: customvariant handling in variants.pp and fmtbcd.pp

2011-03-23 Thread LacaK
Hi Sergei, I can fix it by following fixs: 1. fmtbcd_castto.diff ... added case when castto varString is requested ... then do not use cast throught varDouble (to avoid lost of precision), but convert directly from TBCD to string 2. variants.pp ... here we must add handling of customvariant

Re: [fpc-devel] RFC: customvariant handling in variants.pp and fmtbcd.pp

2011-03-23 Thread Sergei Gorelkin
LacaK пишет: I can fix it by following fixs: 1. fmtbcd_castto.diff ... added case when castto varString is requested ... then do not use cast throught varDouble (to avoid lost of precision), but convert directly from TBCD to string 2. variants.pp ... here we must add handling of customvaria

[fpc-devel] RFC: customvariant handling in variants.pp and fmtbcd.pp

2011-03-23 Thread LacaK
Hi, I would like ask for your opinion in this case. I found, that in this sample program is raised "Invalid variant ..." var bcd1: TBCD; v,v1: variant; s: string; begin bcd1:=2; v1:=varfmtbcdcreate(bcd1); s:=v1; //assigment from customvariant to string is not handled in sysvar