[fpc-pascal] Re: Access violation that I do not understand while creating a class instance

Henry Vermaak henry.vermaak at gmail.com
Mon Jan 23 16:10:56 CET 2012


On 23/01/12 14:56, ik wrote:
> On Mon, Jan 23, 2012 at 16:28, ik <idokan at gmail.com
> <mailto:idokan at gmail.com>> wrote:
>
>     Hello,
>
>     In the following code
>     (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?

Henry



More information about the fpc-pascal mailing list