【C++错误处理】VC6中关于bool __cdecl std::isdigit(_E,const class std::locale &)' : expects 2 arguments

作者:gnuhpc
出处:
http://www.cnblogs.com/gnuhpc/

今天在用VC6调试一个别人写的示例程序时,发现了这么一个错误:

 

bool __cdecl std::isdigit(_E,const class std::locale &)' : expects 2 arguments

 

出错的代码:

         

[cpp] view plaincopy

1.  return std::isdigit(_expr[_pos]) != 0; 

2.          bool (isdigit)(_E _C, const locale& _L) 

3.   

4.  while (_pos < _expr.length() && std::isdigit(_expr[_pos]) != 0) 

  

 

MSDN isdigit的定义如下:
template<class E>;
    bool isdigit(E c, const locale& loc) const;    

The template function returns use_facet< ctype<E>; >;(loc). is(ctype<E>;:: digit, c).

 

没有怎么看懂为什么MS把这么简单的一个函数定义的如此复杂...

 

后来看一个老外的解决方法:

you are using the std template version is isdigit which apparently requires two parameters. remove the std:: namespace and the compiler will use the standard C version that only requires one parmeter.

 

自然就解决了VC6标准模板和标准C之间的差别问题。

作者:gnuhpc
出处:
http://www.cnblogs.com/gnuhpc/

 

posted @ 2012-12-10 21:02  gnuhpc  阅读(999)  评论(0编辑  收藏  举报