Fra*_*ank 3 c++ unix namespaces header-files
考虑以下一小段代码:
// all of these include other headers, lots of code:
#include "myheader1.h"
#include "myheader2.h"
#include <string>
void foo() {
string s("hello world"); // oh no, why does this compile??
}
Run Code Online (Sandbox Code Playgroud)
这个编译,显然一些递归包含的头文件有一个
using namespace std;
Run Code Online (Sandbox Code Playgroud)
某处.您将如何找到违规代码行的位置?
只是grep在所有头文件上使用都不会真正起作用,因为该语句通常在函数内部使用,它是安全的并且不会污染其余的代码.
| 归档时间: |
|
| 查看次数: |
177 次 |
| 最近记录: |