C语言技巧
来源:互联网 发布:多益网络和37和4399 编辑:程序博客网 时间:2024/06/05 16:02
把自己学习C语言的技巧记录下来,以免忘记,每天至少一更
File I/O
1. Size of File Descriptor Table is limited. Make sure to close file descriptor when read and write in a large number of times.
2. Use following format to read and write content from/to files:
byte_read = read(infd, buf, BLKSIZE);...write(outfd, buf, byte_read);
Optimization
1. Use local variable rather than dynamic memory allocation to prevent memory leak.
String
1. Do not use equal sign, use strcpy instead.
2. 当在函数中初始化一个local char* 时,用bzero初始化
定义含有自身type的struct时, 直接用struct + 自身type。
typedef struct queue_node { char* client; struct queue_node *next;} queue_node_t;
0 0
- c 语言小技巧
- C语言编程技巧
- C语言宏技巧
- c语言技巧二
- C语言宏技巧
- C语言编程技巧
- C语言编程技巧
- C 语言技巧
- gnu c语言技巧
- 学习C语言技巧
- C语言技巧
- c语言技巧
- C语言技巧
- C语言使用技巧
- C语言技巧
- c语言优化技巧
- C语言编程技巧
- C语言技巧
- 与大二学生讨论专业学习
- 表视图
- javascript插入样式
- ElasticSearch Shard Placement Control
- 修改adb devices列表中设备串号名称
- C语言技巧
- centos开机界面的自己订制
- 定制单元格
- Booting Xen
- Cookie 和 Session
- 【amazing cocos2d-x 3.0之十四】内存管理(2):纹理缓存(Texture Cache)
- 小迪子在学习
- redis 的监控
- 触摸与手势