On Wed, 16 Mar 2022, Bart via fpc-devel wrote:
Hi,
User Nimral in the wiki noted this:
If you specify ifoWriteStringBoolean in Options for TIniFile _and_ you
forget to assign values to BoolTrueStrings/BoolFalseStrings, then
writing and reading boolean values is not symmetrical.
Writing a boolean will write either 'true' or 'false', but reading
calls CharToBool on the found string.
Consider this piece of code:
Ini := TIniFile.Create('test.ini');
Ini.Options := [ifoWriteStringBoolean]; //[ifoWriteStringBoolean]
It does not say ifoReadStringBoolean or ifoReadWriteStringBoolean for a
reason. So the behaviour is as designed.
The behaviour was introduced for compatibility with other development
environments.
Which is not to say that we cannot change the behaviour.
See
https://gitlab.com/freepascal.org/fpc/source/-/issues/39625
Michael.
_______________________________________________
fpc-devel maillist - [email protected]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel