On Mon, Jan 23, 2012 at 17:10, Henry Vermaak <henry.verm...@gmail.com>wrote:

> On 23/01/12 14:56, ik wrote:
>
>> On Mon, Jan 23, 2012 at 16:28, ik <ido...@gmail.com
>> <mailto:ido...@gmail.com>> wrote:
>>
>>    Hello,
>>
>>    In the following code
>>    (https://github.com/ik5/redit_**client.fpc/blob/master/tests/**
>> test_parser.lpr#L55<https://github.com/ik5/redit_client.fpc/blob/master/tests/test_parser.lpr#L55>
>> ),
>>
>>    when I point, I have access violation when trying to create
>>    TRedisErrorReturnType.Create
>>
>>    It does not happen for TRedisStatusReturnType.Create for example,
>>    that have the same parent as TRedisErrorReturnType.
>>
>>    What am I missing or doing wrong here ?
>>
>>
>> Solved it, but I do not understand it.
>> Why did new made access violation and StrAlloc not ?
>>
>
> Because new() just allocated one pchar and not a buffer.  Why do you think
> using a pchar like this is faster than using string?  Have you benchmarked
> it?
>

I haven't benchmark anything in my life :)
PChar is an array like approach. AnsiString, is a record based pointer. It
uses more memory, and provide a bit overhead for the same thing.
At least on theory. I would love to learn that it's not the case.

Thanks


>
> Henry
> ______________________________**_________________
> fpc-pascal maillist  -  
> fpc-pascal@lists.freepascal.**org<fpc-pascal@lists.freepascal.org>
> http://lists.freepascal.org/**mailman/listinfo/fpc-pascal<http://lists.freepascal.org/mailman/listinfo/fpc-pascal>
>

Ido
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to