[fpc-devel] StrPos giving a access violation
Micha Nelissen
micha at neli.hopto.org
Mon Dec 12 13:30:00 CET 2005
Graeme Geldenhuys wrote:
> Taken from Delphi 7 help:
>
> Mixing Delphi strings and null-terminated strings
>
> * You can also use Pointer(S) to cast a long string to an untyped
> pointer. But if S is empty, the typecast returns nil.
> * PChar(S) always returns a pointer to a memory block; if S is empty, a
> pointer to #0 is returned.
Thanks, that is very ugly. That means that PChar(Pointer(MyStr)) is not
the same as PChar(MyStr) which is not very pascalish IMHO, but ok.
I can understand that PChar(MyStr) to always return a valid pointer is a
desirable property of course, but why not use a function instead that
does this ? Useless question, of course.
Micha
More information about the fpc-devel
mailing list