mrw wrote:
> Well, I've been having a further look at this.
>
> I think I do prefer your -strtod_l + C locale - approach, in principle,
> together with my own predilection of a fallback to the system's locale
> in case of failure.
>
> The coding is much sweeter and shorter, at least on macOS, which
> pleasingly accepts a 'NULL' locale as meaning the C locale, and only
> requires an extra -# include <xlocale.h>-. And I think FreeBSD follows
> the same pattern.
>
> But, as far as I can see, both GNU C and VS will require the creation of
> a 'C locale' object to be passed to -strtod_l-, twice, meaning more
> lines of code. And neither want the -# include <xlocale.h>-. Oh, and VS
> calls it -_strtod_l-.
>
> So while we can get a much nicer bit of code actually doing the job,
> there is a certain amount of infernal platform dependent setup required
> to achieve it that might, in reality, over-complicate matters.
>
> MinGW apparently doesn't implement it at all. At least not according to
> a 2017 reference that I found.
>
> I shall sleep on it.
Some users seem to prefer using a "C" locale rather than NULL especially
in this context. Again it is a definitive choice as I think NULL locale
may mean default which may vary on different system MacOS, Win32,BSD,
Linux, etc.
Code:
--------------------
ret += strtod_l(s, &endptr, newlocale(LC_ALL_MASK, "C", NULL));
--------------------
xlocale.h seems to have been removed in later version of glib so that
could be wrinkle.
I also saw Win32 has _strtod_l rather than strtod_l so somehting like
following is needed/
Code:
--------------------
#ifdef _WIN32
#define strtod_l _strtod_l
#endif
--------------------
------------------------------------------------------------------------
bpa's Profile: http://forums.slimdevices.com/member.php?userid=1806
View this thread: http://forums.slimdevices.com/showthread.php?t=110871
_______________________________________________
Squeezecenter mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/squeezecenter