smeenai added a comment. I'm aware that my replacement code isn't entirely equivalent, since it won't restore the locale in case `MB_CUR_MAX` throws. However, I'm quite certain the `MB_CUR_MAX` implementation won't throw. I can make my own RAII wrapper if desired, however.
Alternatively, MSDN documents an ___mb_cur_max_l_func <https://msdn.microsoft.com/en-us/library/ff730816%28v=vs.140%29.aspx>, which is available Visual Studio 2013 onwards and does exactly what we want. It does warn that it's an internal CRT function and recommends against its use, hence my current implementation avoiding it. However, if we're okay using internal CRT functions, it would make for a cleaner implementation, and avoid the locale restoration issues altogether. https://reviews.llvm.org/D24374 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits