我在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警告?