2013年10月12日
摘要: http://rogerdudler.github.io/git-guide/index.zh.html 阅读全文
posted @ 2013-10-12 09:15 chenkkkabc 阅读(154) 评论(0) 推荐(0) 编辑
  2013年10月9日
摘要: Diagnostics定义宏:void assert (scalar-expression);若expression为0,则打印出错信息(类似Assertion failed: expression, function abc, file xyz, line nnn.),调用abort函数中断程序执行。若定义了NDEBUG,则assert宏无效: #define assert(ignore) ((void)0)static_assert ( constant-expression , string-literal ) ;编译期断言。可扩展成_Static_assert// gcc -std=c 阅读全文
posted @ 2013-10-09 15:32 chenkkkabc 阅读(489) 评论(0) 推荐(0) 编辑
  2013年10月8日
摘要: Common definitions定义类型:ptrdiff_t 两指针相减的结果,signed integersize_t sizeof操作符的结果,unsigned integermax_align_t 和实际支持的alignment一样大的对象类型wchar_t 能够表示所有最大扩展字符集的编码值,integer定义宏:NULL 空指针常量offsetof(type, member-designator) 求结构体成员的偏移量,若是位域,则是未定义行为// gcc -std=c11 test_stddef.c#include struct S { int a; int b;};int.. 阅读全文
posted @ 2013-10-08 12:32 chenkkkabc 阅读(470) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2013-10-08 12:13 chenkkkabc 阅读(479) 评论(0) 推荐(0) 编辑
  2013年9月30日
摘要: Constant包括4种类型:整型浮点型枚举字符型#include #include int main() { /* Integer constant */ int a01 = 1, a02 = -1000; // decimal int a11 = 011, a12 = -0777; // octal int a21 = 0xabcdef, a22 = 0XABCDEF; // hexadecimal long a31 = 10000l, a32 = 10000L; // long long long a41 = 100000000000000ll, a42 = 10000000... 阅读全文
posted @ 2013-09-30 14:16 chenkkkabc 阅读(661) 评论(0) 推荐(0) 编辑
  2013年9月27日
摘要: #include char* strcpy(char* dest, const char* src){ if (dest == NULL || src == NULL) return NULL; if (dest == src) return dest; char* tmp = dest; while ((*dest++ = *src++) != '\0'); return tmp;} 阅读全文
posted @ 2013-09-27 17:06 chenkkkabc 阅读(142) 评论(0) 推荐(0) 编辑
摘要: C语言关键字 sizeof 是一个操作符,返回对象或类型所占内存字节数,类型为size_t(定义在),有2种用法:sizeof unary-expressionsizeof (type-name)sizeof不能应用的场合:an expression that has function type or an incomplete typethe parenthesized name of such a typean expression that designates a bit-field member如果操作数的类型是VLA (variable length array),要进行evalu 阅读全文
posted @ 2013-09-27 15:43 chenkkkabc 阅读(831) 评论(4) 推荐(0) 编辑
  2013年9月12日
摘要: http://www.cplusplus.com/reference/utility/pair/用于存储一对异构对象// Compile: g++ -std=c++11 pair.cpp#include #include #include #include int main () { std::pair p1; // default constructor p1 = std::make_pair(std::string("alpha"), 1); // using make_pair (mo... 阅读全文
posted @ 2013-09-12 13:44 chenkkkabc 阅读(313) 评论(0) 推荐(0) 编辑
  2013年9月5日
摘要: #include #include #include templatevoid print_map(const MapType & map, const std::string & separator, std::ostream & os ){ typedef typename MapType::const_iterator const_iterator; for( const_iterator i = map.begin(), iend = map.end(); i != iend; ++i ) { os... 阅读全文
posted @ 2013-09-05 16:45 chenkkkabc 阅读(279) 评论(0) 推荐(0) 编辑
  2013年9月4日
摘要: 例1$ cat test1abcdefghijklmnopqrstuvwxyz$ cut test1 -c 1ahorux$ cut test1 -c 2,4-6bdefiklmpsvy$ cut test1 -c -4abcdhijkopqrstuvwxyz$ cut test1 -c 3-cdefgjklmnqtwz$ cut test1 -c -3,3-abcdefghijklmnopqrstuvwxyz例2$ cat test2星期一星期二星期三$ cut test2 -c 3一二三$ cut test2 -b 3���汉字是utf8编码,3字节$ cut test2 -nb 9一二三 阅读全文
posted @ 2013-09-04 15:38 chenkkkabc 阅读(344) 评论(0) 推荐(1) 编辑