User Changes 2.6.4/ru

From Lazarus wiki
Jump to navigationJump to search

О чём эта статья

Здесь представлены изменения, которые внесены в компилятор FPC версии 2.6.4 после предыдущего релиза, которые могут вызвать в некоторых случаях невозможность работы кода программы. The list includes reasons why these changes have been implemented, and suggestions for how you might adapt your code if you find that previously working code has been adversely affected by these recent changes. Список включает в себя причины, по которым эти изменения были внесены и предложения о том, как вы можете доработать свой код если вы обнаружите, что ранее работавщий код вдруг оказался нерабочим вследствие этих изменений.

Все системы

Изменения в модулях

DB

TODBCConnection (odbcconn) - Больше нет автоматического подтверждения изменений
  • Old behaviour: Autocommit was enabled: Every change was committed to the database at once.
  • New behaviour: Changes must be committed explicitly using Transaction.Commit
  • Reason: Transactions are useless if everything is autocommitted: in particular; rollback is not possible.
  • Remedy: You can enable autocommit by specifying AUTOCOMMIT=1 in the params of TODBCConnection.
TDBF - Из модуля удалено предупреждение "Не использовать" (deprecation)
  • Old behaviour: the TDBF units were marked deprecated because the original maintainer of the upstream project stopped maintenance. However, the unit remained in fcl-db and patches were still accepted.
  • New behaviour: the deprecation warning is removed. There is a new upstream project maintainer and FPC database devs support this unit again.
  • Remedy: N/A

FPCanvas - свойство Strikethough исправлено написание - StrikeThrough

  • Old behaviour: Fonts had a Striketrough property which is a typo.
  • New behaviour: The property has been changed to Strikethrough.
  • Reason: Spelling fix.
  • Remedy: Please rename property calls in your code. FPC 2.6.2 contains both versions so there is a window for adaptation.

Ссылка shlobj удалена из модуля Windows

  • Old behaviour: When unit windows was split between the windows and shlobj units, not all shlobj symbols were removed from Windows.
  • New behaviour:
    • Now: the symbols are marked deprecated in the windows unit.
    • Next major version: shlobj symbols will be removed from the windows unit. Code relying on that will fail to compile if it doesn't import shlobj.
  • Reason: shlobj and windows versions were not compatible and lead to errors.
  • Remedy: put shlobj in your uses, if not there already.

В StrUtils добавлена реализация RomanToInt

  • Old behaviour: Providing an invalid input to RomanToInt would return 0.
  • New behaviour: Providing an invalid input to RomanToInt will raise an EConvert error.
  • Reason: What constitutes "Invalid input" was very arbitrary: only invalid characters constituted an error. Right characters in wrong places would be erroneously translated. Now the implementation has the three usual implementations TryRomanToInt, RomanToIntDef and RomanToInt
  • Remedy: Use RomanToIntDef. The Default value used in case of error is declared with default 0, making the signature and behaviour equivalent to the old function.

Метод Classes.TStringList.InsertItem теперь представлен как виртуальный с двойной реализацией

  • Old behaviour: The two InsertItem methods (both Virtual) had their own implementation. This double virtual method is probably an ancient form of default parameter by overloading. If you wanted to override InsertItem, you had to override them both.
  • New behaviour: InsertItem(Index,String) now calls InsertItem(Index,String,nil). This means that users can and should only override the 3 parameter version. In case both methods are overridden, this can lead to duplicate execution of the override code.
  • Reason: Only having to override one method. However this breaks code that overrode both.
  • Remedy: Only override the three parameter version.