string 头文件 有点烦<string> <string.h> <cstring>

深陷烂代码的泥潭之中....

 

在C语言里面, 要用到memset之类的C库, 一般会:

#include <string.h>

C++兼容C代码, 意味这上面在C++里面也是可用的。

在C代码向C++迁移的时候, 还是建议用:

#include <cstring>

因为要和STL的string头文件区分

#include <string>

 

最后就是这样子:

#include <string>
#include <cstring>

 

看起来是不是明了多了     :)

posted @ 2015-05-28 12:49  luikimfai  Views(198)  Comments(0)    收藏  举报