随笔分类 -  C++

摘要:#include #include int MyAtoi(const char* str) { if (str == NULL) return 0; int slen = strlen(str); if(slen ='0')&&(*c <= '9')) { t = *c-'0'; ret = ret *10+... 阅读全文
posted @ 2015-02-28 21:06 孙永杰 阅读(629) 评论(2) 推荐(0)
摘要://class Resource {//public:// Resource(parms p): r(allocate(p)) { }// ~Resource() { release(r); }// // also need to define copy and assignmen... 阅读全文
posted @ 2015-02-28 18:33 孙永杰 阅读(318) 评论(0) 推荐(0)
摘要:如果需要使用 INT64_MAX ,在centos 64位下,需要使用g++ 4.7.0 then -std=c++11, -std=c++0x也不行 阅读全文
posted @ 2015-02-13 20:10 孙永杰 阅读(173) 评论(0) 推荐(0)
摘要:最好不要使用"string.h",stdint.h,iostream.h这样的头文件,这些都是C的头文件习惯使用 阅读全文
posted @ 2015-02-13 19:59 孙永杰 阅读(318) 评论(0) 推荐(0)
摘要:// 以下摘自网络静态函数在函数的返回类型前加上关键字static,函数就被定义成为静态函数。函数的定义和声明默认情况下是extern的,但静态函数只是在声明他的文件当中可见,不能被其他文件所用。定义静态函数的好处: 其他文件中可以定义相同名字的函数,不会发生冲突 静态函数不能被其他文件所用。 存储... 阅读全文
posted @ 2015-02-11 12:41 孙永杰 阅读(1083) 评论(1) 推荐(0)
摘要:#include #include #ifdef __linux#include #endif// 编译器真是相当友好啊warning C4172: returning address of local// variable or temporary 一定不要返回局部变量啊char* GetMemo... 阅读全文
posted @ 2015-01-29 10:00 孙永杰 阅读(230) 评论(0) 推荐(0)
摘要:http://blog.csdn.net/pongba/archive/2008/06/13/2544894.aspx 阅读全文
posted @ 2011-01-05 17:50 孙永杰 阅读(128) 评论(0) 推荐(0)
摘要:转载于刘未鹏文章http://blog.csdn.net/pongba/archive/2003/10/24/19130.aspx 阅读全文
posted @ 2011-01-04 17:42 孙永杰 阅读(120) 评论(0) 推荐(0)