[fpc-devel] Re: dominant short strings in compiler source

Tomas Hajny XHajT03 at mbox.vol.cz
Sat May 20 20:03:43 CEST 2006


On 20 May 06, at 11:43, L505 wrote:

> >  .
> >  .
> > > have tight custom units with no end user units like sysutils. One way to accomplish
> this,
> > > like I've already mentioned, is to use shortstring/longstring/array of string/ based
> Dos
> > > unit, using shortstrings where necessary, arrays of strings where necessary, and
> arrays of
> > > chars or longstrings where necessary. An array of char is just a dumb longstring,
> that's
> > > all. Upgraded Dos unit could contain some functions pulled in from sysutils, but not
> > > actual sysutils in the uses clause - just some optimized systutils pulled in and put
> into
> > > the upgraded dos unit. Still keeping the old Dos unit for compatibility for users,
> name
> > > the new upgraded dos unit anything - newdos.pp, whatever.
> >  .
> >  .
> >
> > It would be much more than just unit Dos - you'd
> > need changes in at least System (string
> > manipulation routines), strings (StrPCopy) and
> > many parts of the compiler itself.
> >
> > Regarding unit Dos - providing PChar versions of
> > some routines might be of general use, probably
> > more useful than longstrings.
> 
> Admitting that C-language style programming (*char) is more practical and real world than
> Pascal programming?

;-) Well, that depends. I certainly don't think 
that *char is more practical for string 
manipulation in general. However, when talking 
about unit DOS, the underlying OS API calls 
usually expect null terminated strings anyway. 
Anybody could then decide whether he prefers the 
easy to use Pascal string, because he only starts 
executables with few parameters which could never 
cross the limit, or whether he needs PChar for 
whatever reason.

Tomas



More information about the fpc-devel mailing list