[vtkusers] wx/vtk weirdness

Francois Bertel francois.bertel at kitware.com
Fri Nov 27 12:05:07 EST 2009


note: it is necessary to duplicate the return value of setlocale() as
it can be a pointer to a static string.

On Fri, Nov 27, 2009 at 12:04 PM, Francois Bertel
<francois.bertel at kitware.com> wrote:
> Something like that:
>
> // save the current locale
>  prev_locale = setlocale(LC_NUMERIC, NULL);
>  prev_locale = dupstring(setlocale(LC_NUMERIC, NULL));
> setlocale(LC_NUMERIC, "POSIX");
>
> <reader code here>
>
> // Restore locale
> setlocale(LC_NUMERIC, prev_locale);
> if(prev_locale)
> {
>  setlocale(LC_NUMERIC, prev_locale);
> }
>
> ref: http://www.zsh.org/mla/workers/2003/msg00210.html
>
> I don't think bug 5891 is relevant as it elimitates the use of
> interpretation of text into numerical values.
> Patch in bug 1431 was using the selocale() function (as above).
>
>
> On Fri, Nov 27, 2009 at 11:58 AM, Mathieu Malaterre
> <mathieu.malaterre at gmail.com> wrote:
>> On Fri, Nov 27, 2009 at 5:57 PM, Marcus D. Hanwell
>> <marcus.hanwell at kitware.com> wrote:
>>> The C functions as I remember set the locale globally which can also cause
>>> unexpected bugs if a library changes this internally.
>>
>> Ah ! That answer my question :)
>>
>> Thx
>> --
>> Mathieu
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtkusers
>>
>
>
>
> --
> François Bertel, PhD  | Kitware Inc. Suite 204
> 1 (518) 371 3971 x113 | 28 Corporate Drive
>                      | Clifton Park NY 12065, USA
>



-- 
François Bertel, PhD  | Kitware Inc. Suite 204
1 (518) 371 3971 x113 | 28 Corporate Drive
                      | Clifton Park NY 12065, USA



More information about the vtkusers mailing list