相关疑难解决方法(0)

g ++没有显示"未使用"警告

我在C++中有一小段代码:

#include <iostream>
#include <iterator>
#include <string>

using namespace std;

int main() {

    int i=0;
    istream_iterator<string> EOS;
    double x;

    return 0;
}
Run Code Online (Sandbox Code Playgroud)

现在我用我的g ++(GCC)4.4.4编译它

g++ -W -Wall -pedantic test.cc -o test
Run Code Online (Sandbox Code Playgroud)

得到:

test.cc: In function 'int main()':
test.cc:9: warning: unused variable 'i'
test.cc:11: warning: unused variable 'x'
Run Code Online (Sandbox Code Playgroud)

为什么没有未使用的EOS警告?

c++ g++

23
推荐指数
2
解决办法
1772
查看次数

标签 统计

c++ ×1

g++ ×1