[关闭]
@breakerthb 2017-07-14T02:10:46.000000Z 字数 538 阅读 1181

C/C++技巧

URL C/C++


基础

STL

STL - vector
STL - list
string
deque

set
multiset
map
multimap

数据结构

排序

简单插入排序
归并排序

HashMap

HashTableMap
LinkedHashMap

Linux开发

LinuxPrograming

Windows开发


代码技巧

1. 判断一个数是2的n次方

(value & (value -1)) == 0

2. 关闭无用的管道

if(close(STDIN_FILENO) == -1){
    exit(0);
}
if(close(STDOUT_FILENO) == -1){
    exit(0);
}
if(close(STDERR_FILENO) == -1){
    exit(0);
}

3. memset warning

getinfo.c:200:13: warning: incompatible implicit declaration of built-in function 'memset' [enabled by default]

         memset(gnValueBak, 0, BUF_SIZE * sizeof(unsigned int));

解决:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注