Can isdigit legitimately be locale dependent in C

倾然丶 夕夏残阳落幕 提交于 2019-11-28 01:48:22
Alexander Pogrebnyak
  1. Microsoft is always right.
  2. If Microsoft is not right see Item 1

Microsoft always has its own interpretation of the spec. And usually the sentence “but Microsoft is wrong” does not carry any weight with your CEO, so you have to code around MS bugs/interpretations.

The amount of code to support incorrect behavior of IE and Outlook is staggering.

In many cases, the only solution is to roll your own version of the function that does the right thing and do something like this:

int my_isdigit( int c )
{
#ifdef WIN32
  your implementation goes here
#else
  return isdigit( c );
#endif
}

The required character set is defined in section 2.2.1. Section 2.2.1.2 then goes on to describe the behavior of extension characters:

  • The single-byte characters defined in $2.2.1 shall be present.
  • The presence, meaning, and representation of any additional members is locale-specific.
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!