On 1/2/2010, "Freddie Unpenstein" <fredde...@excite.com> wrote:
>> There's nothing at all wrong with it in the context you specified >> -- i.e. you want to ensure that floating-point values written to >> and read from file always use '.' as the decimal separator. I do >> that in my app, gretl (also for reasons of portability). > >The problem would be the potential that the library may have cached locale >features under a different locale, wouldn't it? That could lead to either >uninitialised bytes, or buffer overrun. > So what's the point of having a setlocale function which can tell you the locale in use and/or set a new locale to use if this stuff is going to be stored in cache and read/write of locale settings is going to break the library and your program? Or are you saying the libraries (gtk/mpfr/stdc) I'm using may be caching the locale and may not heed my changes? >From personal experience; I've first-use-allocated strings with all the >thousands characters, and an array of byte offsets at which to put the higher >portions of numbers, and then used a regular floating point format to write >the last thousand (sprintf comes to mind). If the locale were to unexpectedly >change to one that uses a multi-byte decimal point, a buffer overrun would >certainly occur. In the opposing case, that same function would likely write >out a null character following the number. > Are you talking about a change from outside the program? Say, whichever X environment changes locale settings (do running programs take notice then?). Cheers, James. >Could cause quite some stress. > > >Fredderic > >------------------------------------------------------------ >Best Weight Loss Program - Click Here! >Weight Loss Program >http://tagline.excite.com/c?cp=vXYG-fGF-EFlsgtFzMFtVgAAKZSqLQhMVy_O-FcGiDoF0G0BAAYAAAAAAAAAAAAAAAAAAADNAAAAAAAAAAAAAAAAAAAEUkgwwww= > _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list