[fpc-devel]bug in comparing of two pchars

Marco van de Voort marcov at stack.nl
Mon Mar 19 12:14:35 CET 2001

> "Pavel V. Ozerski" wrote:
> > 
> > Hello,
> > please fix a bug.
> I don't think this is a bug...
> > comparing pchar variable with string constant is not supported by compiler if this constant has one-character length.
> You cannot compare PChar strings directly using the "=" operator; use
> functions such as strcomp instead. PChar is just a pointer type, and "="
> will compare the address.
> "p='T'" is a special case: Here the compiler does an automatic pointer
> dereference, and as PChar is equivalent to ^Char, it's clear that this
> comparison will check the first character of p.

The compare operator works on ansistring, and pchar can be autoconverted to
ansistring in some cases.

More information about the fpc-devel mailing list