I have the following program.
var a: PChar := PChar('abc');
ShowMessage(Format('%p - %p', [@a, a]));
When I run it, I got this error:
Project Project1.exe raised exception class EConvertError with message 'Format '%p - %p' invalid or incompatible with argument'.
The problem is that a
can't be formatted as %p
. But as I understand, PChar is defined as ^Char
. So a PChar is essentially a pointer to Char. It's a pointer. Why can't format it as %p
? The following code works without any issue:
var c: Char := 'x';
var a := @c;
Format('%p - %p', [@a, a]); // 0019F364 - 0019F36A