vc bug?

neptune 2001-04-28 11:02:00
用几个map就出一大堆warning c4786,我都 #pragma warning (disable:4786)了
...全文
102 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
cber 2001-04-28
  • 打赏
  • 举报
回复
有意思,我回头好好看看.
neptune 2001-04-28
  • 打赏
  • 举报
回复
这77个和64个warning全是waring: C4786
neptune 2001-04-28
  • 打赏
  • 举报
回复
这样,
#include <map>
#include <string>
using namespace std;

int main()
{
map<string, float> table;
return 0;
}

test.obj - 0 error(s), 77 warning(s)

如果
#include <map>
#include <string>
#pragma warning (disable:4786)

using namespace std;

int main()
{
map<string, float> table;
return 0;
}

test.obj - 0 error(s), 64 warning(s)

环境vc6.0
cber 2001-04-28
  • 打赏
  • 举报
回复
my test:

#include <map>

#pragma warning (disable:4786)

using namespace std;

int main()
{
map<int, char> mymap;
return 0;
}

save as m.cpp, and using the following command-line compiler, no warning:
cl m.cpp
but using this command-line, warnings appear:
cl /W4 m.cpp --set the highest warning level
but no c4786 wanring show even other warnings show.

Have set the compiler option correctly???
ed9er 2001-04-28
  • 打赏
  • 举报
回复
:(
我也是,最简单的vector<string>就会冒4786,只能progma,没别的办法,害得我还要写
#ifdef WIN32

....
cber 2001-04-28
  • 打赏
  • 举报
回复
C4786在MSDN中的解释是标识符太长,超过255个字符的部分会被截断.
你的程序中出现了这个问题是由于template在实例化时做的一些事情好象macro一样,用了字符串替代的方法,经过了好几次的展开后,就会得到了一个很长的标识符.在这个意义上说,VC确实有点问题.

69,369

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧