[fpc-pascal] Re: Variant vs Pointer

Marcos Douglas md at delfire.net
Fri Mar 2 20:37:34 CET 2012


On Fri, Mar 2, 2012 at 1:02 PM,  <michael.vancanneyt at wisa.be> wrote:
>
>
> On Fri, 2 Mar 2012, Marcos Douglas wrote:
>
>> On Wed, Feb 29, 2012 at 10:38 PM, Marcos Douglas <md at delfire.net> wrote:
>>>
>>> Hi,
>>>
>>> The TField class have the FValueBuffer: Pointer attribute and have
>>> also SetData(Buffer: Pointer,...) method that all T***Field subclasses
>>> use to set themselves.
>>> The methods AsInteger, AsString, etc use FValueBuffer to convert in an
>>> especific type. So, FValueBuffer could be anything.
>>>
>>> My question is:
>>> What would be the difference in performance if FValueBuffer were a
>>> Variant type?
>>>
>>> Marcos Douglas
>>
>>
>> Nobody knows?
>>
>> I need implements a similar structure but I need know if the use of
>> Variant have very cost.
>
>
> It has a cost.
>
> The reason for using a buffer in tdataset is that a record's data normally
> is located in one continuous buffer, from which a value is picked from the
> right spot (including strings) You can't have that with variants.

Hm... right.
So, if I will have a class like a TParam, that have FValue: Variant
attribute, Would you change the implementation to not use Variant?

Marcos Douglas



More information about the fpc-pascal mailing list