[fpc-pascal] more questions on storage

Marc Santhoff M.Santhoff at t-online.de
Wed Sep 26 13:18:19 CEST 2007


Am Mittwoch, den 26.09.2007, 12:55 +0200 schrieb Jonas Maebe:
> On 26 Sep 2007, at 11:56, Marc Santhoff wrote:
> 
> >> Longstrings were never completely implemented nor tested, so no one
> >> really knows what works and what doesn't. It would be better if the
> >> compiler simply gave an error for them at compile time.
> >
> > That's irritating, because "rtl.pdf" from the 2.0.4 release says on  
> > page
> > 19:
> >
> > 1.1.20 $H or $LONGSTRINGS : Use AnsiStrings
> > If {$LONGSTRINGS ON} is specified, the keyword String (no length
> > specifier) will be treated
> > as AnsiString, and the compiler will treat the corresponding  
> > variable as
> > an ansistring, and will
> > generate corresponding code.
> >
> > I read it as there is no difference between the two (in that release)
> > and the compiler switches can be exchanged.
> 
> It seems there's some confusion in terminology. {$longstrings on}  
> maps to {$h+}, which indeed means that string becomes an alias for  
> ansistring rather than for shortstring. Separately from that there is  
> also a type called "longstring" which is basically a shortstring but  
> with a 4 byte length field. It's this longstring which has not been  
> implemented properly.
> 
> Ansistrings (and thus {$longstrings on}) work fine.

Ah, okay. The Fog is lifting fastly. :)

And AnsiStrings are pretty much compatible to C's char*. Very handy.

Many thanks,
Marc





More information about the fpc-pascal mailing list