Potential locking issue in newlocale

Jakub Jelinek jakub@redhat.com
Fri Jul 16 13:26:00 GMT 2004


On Fri, Jul 16, 2004 at 11:22:07AM +0200, Jakub Jelinek wrote:
> My biggest surprise is the
> const int max_locales = 10;
> ...
>       for (int i = 0; i < max_loop_count; ++i)
>         {
>           int k = i % max_locales;
>           loc[k] = std::locale::global(loc[k]);
> 
>           if (i % 37 == 0)
>             loc[k] = loc[k].combine<std::ctype<char> >(loc_c);
>         }
> loop is not actually modulo 10, but modulo 11 in the C library calls,

Oops, my bad, that is correct because of the loc[k] = assignment.
Sorry.

	Jakub



More information about the Libstdc++ mailing list