[fpc-devel] dominant short strings in compiler source

Daniël Mantione daniel.mantione at freepascal.org
Wed May 17 22:37:17 CEST 2006



Op Wed, 17 May 2006, schreef L505:

> > > On 17 mei 2006, at 19:59, L505 wrote:
> > >
> > >> What do you guys thing about the idea to implement what DEC Pascal
> > >> and Extended Pascal
> > >> have - a 2 byte length ShortString (MediumString?), uprdade *some*  of
> > >> the path related
> > >> ShortStrings to be MediumString[1000] instead of ShortString[255].
> > >> For some situations
> > >> it would probably fix some problems immediately just by upgrading  to
> > >> string[1000] or
> > >> even string[500].
> > >
> > >
> > > There is the basis of a "longstring" type in the compiler which does
> > > that more or less, but it was never fully implemented, because nobody
> > > cares/cared about it. And you'd still have to convert these  longstrings
> > > to ansistrings and back every time you interface with  sysutils, which
> > > would introduce extra overhead.
> >
> > IMHO, longstring are wasteful for memory, having a fixed length string
> > of 1000 for paths, which on my computer paths are less 100 chars.
> >
> 
> My paths are less than 100 chars. That is not the problem. Otherwise I wouldn't be
> noticing the bugs I've noticed for the last few years. I've never had a path beyond about
> 50 characters. The problem seems to be that several OPTIONS and PATHS at some point get
> combined into one short string at the end of the "funnel".

Well, dos.exec of course requires the entire command line as a 
shortstring. This is no problem for Dos because Dos has a maximum path length of 128 
chars. For some operating system you could implement a dos.exec which 
accepts an array of shortstrings, which could solve a lot of 
length problems.

Daniël


More information about the fpc-devel mailing list