我使用这个命令来编译下面的代码:
g++ -ansi -pedantic -Wall -Wextra myfile.cpp
我想得到一个警告 int64_t 被转换成 int。但是根本没有任何警告。我怎样才能做到这一点?
我的 g++ 版本是 4.6.1。
//file:myfile.cpp
#include <iostream>
using namespace std;
int main()
{
int64_t yy = 10;
int size = yy;
cout << size << endl;
}
最佳答案
尝试-W转换;由于此警告往往会产生大量噪音,因此它不是 -Wall 的一部分
关于c++ - 将 int64_t 转换为 int 时,如何让 g++ 发出警告?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11554863/