[fpc-devel] StrPos giving a access violation

Michael Van Canneyt michael at freepascal.org
Mon Dec 12 13:09:08 CET 2005



On Mon, 12 Dec 2005, Jonas Maebe wrote:

>
> On 12 dec 2005, at 12:17, Micha Nelissen wrote:
>
>>> strpos, I don't know about Delphi. If you typecast an  ansistring to a 
>>> pchar, then the compiler makes sure that if the  ansistring is empty (and 
>>> thus a null pointer), a valid pointer to an  empty null-terminated string 
>>> is returned.
>> 
>> Is that not also undocumented behaviour ?
>
> I'm quite sure it isn't: afaik typecasting an ansistring to a pchar is fully 
> supported. This means that an empty ansistring must result in an empty (as 
> opposed to an invalid) pchar.

It's explicitly stated in the docs.

Michael.



More information about the fpc-devel mailing list