[Lazarus] Changed Compilers Options, Run, Build versus Build All

Hans-Peter Diettrich DrDiettrich1 at aol.com
Fri Dec 12 16:44:46 CET 2008


Tom Verhoeff schrieb:

>>> [...]
>>> Here is another issue.  When working on a program involving multiple
>>> units, it may turn out that the "Use AnsiStrings" was not set
>>> consistently.
>>>
>>> Students are advised to enable this globally in the Compiler Options,
>>> but they sometimes forget.  Some (given/generated) units also contain
>>> their own {$H+}, others don't. 
>> Is this a student bug or an IDE bug?
> 
> Neither, it is a fact of life :-).  It is a consequence of the fact
> that units from different authors may have been made under different
> assumptions.  Some units are written with the assumption that they will
> be compiled with -Sh, others do not make that assumption and include {$H+}
> in the source.

I'd go the Delphi way, and make "string" dependent on global settings 
only. If somebody wants specific Ansi- or ShortStrings, s/he should use 
the according types, in favor of the generic "string" type. Such strict 
typing will make even legacy code better reusable. I dunno about the 
perfomance of ShortString with FPC, but I don't think that there exist 
many cases, where ShortString really provides any advantage over AnsiString.

A hint for students and teachers: *generic* data types, like "integer" 
or "string", should only be used when *all* operations with such 
variables will work with any current or future implementation of these 
generic types. Consider what will happen when "string" becomes a 
WideString, or the like, as recently happend in RAD Studio (Delphi)...

DoDi




More information about the Lazarus mailing list