[PD-dev] LibPd and locale

Thomas Mayer thomas at residuum.org
Fri Apr 29 00:25:44 CEST 2016


I have discovered a bug in libpd with locale that use comma as decimal
separator. In that case, floats are loaded without the fractional part:

The discussion about this is on Github:

Short form:
The resolution for this bug is to set the number format to C. How to do

- set it at init of libpd. This means, that the number format for the
whole application will be changed, at least in C, other wrappers may
behave differently.

PRO: easy to do.
CONTRA: changes number format for the whole application, and may be
overridden from outside, leading to the same bug.

- set it at entry of every function that converts strings to numbers and
vice-versa, and reset it at leaving.

PRO: The clean approach IMHO.
CONTRA: Some work to do, especially identifying all IO functions that
must be changed. May also imply changes to the Pd source.

What do you think?

"[D]ie Kunst flieht, wenn ihr eure Thaten sofort mit dem historischen
Zeltdach überspannt." (Friedrich Nietzsche - Vom Nutzen und Nachtheil
der Historie für das Leben)

More information about the Pd-dev mailing list