setlocale return value
Call to the function
setlocale(LC_MESSAGES , NULL)
returns ""(empty string)开发者_开发知识库 not Null or any locale.
why do i get this return value ?
is it because this feature is not implemented in the platform ?
On input to setlocale
, the empty string ""
represents the environment's default locale, which may differ from the minimal C locale represented by "C"
. It may be that setlocale
has been called with the empty string and this is the platform's way of indicating that. However, one would hope or even expect that the string returned would be more informative, for example "en_US.UTF8"
.
Perhaps the information in the environment is ill-formed or not supported and this is the best that the system can do. The return value from the purported call to setlocale
with the empty string as input should have been checked, as a failure at that point would have returned a null pointer.
精彩评论