[fpc-devel] new string - question on usage

Tomas Hajny XHajT03 at hajny.biz
Tue Oct 11 09:17:34 CEST 2011


On 11 Oct 11, at 9:01, Hans-Peter Diettrich wrote:
> Jonas Maebe schrieb:
> > On 11 Oct 2011, at 00:06, Luiz Americo Pereira Camara wrote:
> > 
> >> On 10/10/2011 17:56, Jonas Maebe wrote:
> >>> On 10 Oct 2011, at 22:11, Luiz Americo Pereira Camara wrote:
> >>> 
> >>>> 1- Most of LCL must be code page agnostic, so not use
> >>>> UTF8String/AnsiString directly (keep String)
> >>> There is no difference between ansistring and string in {$mode
> >>> delphi} and {$mode objfpc}
> >> OK. There's just one problem using $mode to define the string
> >> behavior: say you have a component written in {$mode delphi}. Than
> >> code written in {$mode delphiunicode} uses that library.
> > 
> > That is no more a problem than using code using string in {$h-} mode
> > with code using string in {$h+} mode.
> 
> IMO {$h} should be dropped, since the compiler is the only application 
> that still uses ShortStrings. At least the default should be {$h+} 
> nowadays, and the compiler should warn or hint whenever a $h directive 
> is found in source code.

Why should it be dropped? There are use cases when a shortstring is 
so much more appropriate (especially for texts known to be short to 
avoid the memory allocation overheads). Why users should be warned 
when using it (especially when using it explicitly)?

Tomas




More information about the fpc-devel mailing list