Recent

Author Topic: [SOLVED] Symbol "DecimalSeparator" is deprecated ?  (Read 19616 times)

Fred vS

  • Hero Member
  • *****
  • Posts: 3826
    • StrumPract is the musicians best friend
[SOLVED] Symbol "DecimalSeparator" is deprecated ?
« on: May 12, 2011, 05:21:21 pm »
Hello everybody  ;)

Quote
Warning: Symbol "DecimalSeparator" is deprecated

OK, but what must i use then ?  :(

For next release of Lazarus:

The compiler gives a message when something is deprecated, well done  ;D
But it could be very useful if the compiler gives also the new name of the deprecated symbol... :-\

Thanks
« Last Edit: May 12, 2011, 08:35:15 pm by fredvs »
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

DirkS

  • Sr. Member
  • ****
  • Posts: 251

Fred vS

  • Hero Member
  • *****
  • Posts: 3826
    • StrumPract is the musicians best friend
Re: Symbol "DecimalSeparator" is deprecated ?
« Reply #2 on: May 12, 2011, 05:56:51 pm »
@DirkS, thank you  ;)

Quote
Locale global variables are deprecated
    Old behaviour: For every locale configuration a variable alias existed (currencystring, *dateformat) using an "absolute" modifier.
    New behaviour: These variable now have the "deprecated" modifier, and a warning is emitted if you use one.
    Reason: FPC has supported the use of these variables in a record since before 2000 called DefaultFormatSettings, Delphi XE now follows suit with "Formatsettings", and deprecated the old ones. In time this might remove the need for "absolute" usage.
    Remedy: Use (Default)Formatsettings as much as possible. Note that that it will still be quite some time before these are actually removed.

Humm, not very clear for a dummy like me  :-X

Quote
Reason: FPC has supported the use of these variables in a record since before 2000

Before 2000 (the date ?, the number ?)  :'(

Quote
Remedy: Use (Default)Formatsettings

OK but how to use it ? %)
« Last Edit: May 12, 2011, 06:09:36 pm by fredvs »
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

Fred vS

  • Hero Member
  • *****
  • Posts: 3826
    • StrumPract is the musicians best friend
[SOLVED]Re: Symbol "DecimalSeparator" is deprecated ?
« Reply #3 on: May 12, 2011, 08:34:49 pm »
OK, i get it  ;D

Quote
DecimalSeparator

must be in new release :

Quote
DefaultFormatSettings.DecimalSeparator

Thanks
« Last Edit: May 12, 2011, 08:36:33 pm by fredvs »
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

DirkS

  • Sr. Member
  • ****
  • Posts: 251
Re: [SOLVED]Re: Symbol "DecimalSeparator" is deprecated ?
« Reply #4 on: May 12, 2011, 10:26:01 pm »
Quote
DecimalSeparator

must be in new release :

Quote
DefaultFormatSettings.DecimalSeparator

Correct. There are also a number of functions that have a (optional) 'TFormatSettings' parameter (see e.g. http://www.freepascal.org/docs-html/rtl/sysutils/format.html).

Gr.
Dirk.

eny

  • Hero Member
  • *****
  • Posts: 1658
Re: Symbol "DecimalSeparator" is deprecated ?
« Reply #5 on: May 13, 2011, 12:11:38 am »
(Default)FormatSettings. See http://wiki.lazarus.freepascal.org/User_Changes_Trunk#Locale_global_variables_are_deprecated

I wonder if the bug is fixed that the decimalseparator is used as a separator between seconds and milliseconds.
I.e. for countries that use a comma (,) as a decimal separater, you'd have to write something silly like:
  StrToDateTime('02-12-2011 12:02:00,000'))

instead of the correct
  StrToDateTime('02-12-2011 12:02:00.000'))
All posts based on: Win11; Lazarus 4_4  (x64) 12-02-2026 (unless specified otherwise...)

Fred vS

  • Hero Member
  • *****
  • Posts: 3826
    • StrumPract is the musicians best friend
Re: [SOLVED] Symbol "DecimalSeparator" is deprecated ?
« Reply #6 on: May 13, 2011, 02:04:18 am »
@ eny

Quote
StrToDateTime('02-12-2011 12:02:00.000'))

could be :

Quote
StrToDateTime('02-12-2011 12:02:00'
+ DefaultFormatSettings.DecimalSeparator +
'000'))

 ::)
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

eny

  • Hero Member
  • *****
  • Posts: 1658
Re: [SOLVED] Symbol "DecimalSeparator" is deprecated ?
« Reply #7 on: May 13, 2011, 10:08:17 am »
@ eny

Quote
StrToDateTime('02-12-2011 12:02:00.000'))

could be :

Quote
StrToDateTime('02-12-2011 12:02:00'
+ DefaultFormatSettings.DecimalSeparator +
'000'))

 ::)
Agreed; there are many ways to fix this  :)
It was just a nuisance that this separator is used in the wrong place (it once took me an hour of debugging to find this behaviour). It's probably because of big D. compatibility.
All posts based on: Win11; Lazarus 4_4  (x64) 12-02-2026 (unless specified otherwise...)

 

TinyPortal © 2005-2018