[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.4.1 What's this confusion about strings?

Turbo Pascal strings have a length byte in front. Since a byte has the range 0 .. 255, this limits a string to 255 characters. However, the Pascal string schema, as defined in section 6.4.3.3.3 of the ISO-10206: 1990 Extended Pascal standard, is a schema record:

 
type
  String (Capacity: Integer) = record
    Length: 0 .. Capacity;
    String: packed array [1 .. Capacity + 1] of Char
  end;

The `+ 1' is a GPC extension to make it feasible to automatically add the `#0' terminator when passing or assigning them to CStrings. Thus at the expense of a little added complexity (must declare capacity, don't use `GetMem' without explicit initialization of the `Capacity' field, and the additional space requirement) you can now have very long strings.



This document was generated by Frank Heckenbach on May, 10 2002 using texi2html