[PATCH] D24374: [libc++] Avoid <memory> include in locale_win32.h
Shoaib Meenai via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 8 21:46:00 PDT 2016
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.
More information about the cfe-commits