[fpc-devel]bug in comparing of two pchars
Sebastian Günther
sguenther at gmx.de
Mon Mar 19 11:25:20 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.
- Sebastian
More information about the fpc-devel
mailing list