[fpc-pascal] string in fpc

Michael Van Canneyt michael at freepascal.org
Sat Feb 11 18:31:50 CET 2006



On Sat, 11 Feb 2006, Marco van de Voort wrote:

> > On 11 Feb 2006, at 17:40, Marco van de Voort wrote:
> > 
> > >> Because shortstring is defined as String[255]
> > >
> > > Hmm. How do I get real shortstring behaviour in delphi mode then?
> > 
> > A string[255] is identical to a "real shortstring".
> 
> I mean including the possibilties to have non-255 sizes.

Simple:

Var 
  A : String[10];

{$H+} just means that for

  A : String;

A is an ansistring.

{$H-} means that for

  A : String;

A is a 255 char string, TP style, and hence is equivalent to

  A : ShortString

As soon as there is a size indication, it's a TP-style string.

Michael.



More information about the fpc-pascal mailing list