[fpc-devel] fpc_pchar_length error

Jonas Maebe jonas.maebe at elis.ugent.be
Mon Dec 12 14:51:36 CET 2005

On 12 dec 2005, at 14:29, Alexandrov Alexandru wrote:

>> I agree with this position.
>> A Nil pointer is usually a sign of a bad or uninitialized value.
> ..but we speak here about the length of the string.

No, the length of pchar's. A string and a pchar are two different  
things in Pascal (although you can convert them into each other). A  
pchar is simply a pointer to an array of characters, by convention  
terminated by chr(0).

> IMO the length of
> null string is the same as the length of an unitialised string.

An uninitialised ansistring's length is defined to be zero by the  
documentation. The length of an uninitialised pchar is nowhere  
defined, nor is the length of an invalid pchar pointer. pchar(null)  
does not have a defined length, just like pchar(1) and pchar(2) don't  
have a defined length.


More information about the fpc-devel mailing list