在C++中使用标准C函数时,我们应该为每个函数添加前缀std::吗?
例如(文件名:) std.C:
#include <cstdio>
int main() {
std::printf("hello\n");
printf("hello\n");
}
Run Code Online (Sandbox Code Playgroud)
该文件可以编译为:
g++ -Wall -Werror -std=c++11 std.C
Run Code Online (Sandbox Code Playgroud)
没有任何错误.
我的问题是:
std::在C++中使用它们时,我们是否应该始终放在所有标准C库函数之前?<stdio.h>和<cstdio>?| 归档时间: |
|
| 查看次数: |
6011 次 |
| 最近记录: |