[fpc-devel] Comparing arrays of char
Jonas Maebe
jonas.maebe at elis.ugent.be
Mon Nov 2 14:18:13 CET 2009
Michael Schnell wrote on Mon, 02 Nov 2009:
> Jonas Maebe wrote:
>> a) if the array is zero-based (i.e., lower bound is 0), then the array
>> of char is treated as a null-terminated string
>> b) if the array is non-zero-based, then the array of char is always
>> checked completely
>
> The Delphi behavior sounds not very obvious :(.
I guess it's because C-arrays are also always 0-based (and in C a char
array is the closest thing there is to a string). But yes, it also
cost me quite a bit of testing before I finally figured out the rules.
> Is this true as well for arrays of char as for arrays of byte ?
You cannot compare an array of byte with another array using the
regular comparison operators, afaik.
Jonas
----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
More information about the fpc-devel
mailing list