C Cookbook
约 1 分钟阅读
标签:实践手册
- git/banned.hGitHub Filegit/git/banned.h
- 不推荐用这些接口
- 因为容易有歧义,经常踩坑
- 看提交历史GitHubgit/git/commits/master/banned.h有原因说明
| banned | alt | reason |
|---|---|---|
| ctime_r, asctime_r | strftime,strbuf_addftime | reentrant, but no check the buffer is long enough |
| gmtime,localtime,ctime,asctime | return pointers to shared storage, not thread-safe | |
| sprintf,vsprintf | strbuf,xstrfmt,xsnprintf | buffer overflow |
| strcpy,strcat, | strbuf,xstrfmt,xsnprintf | 越界 |
| strncpy | strlcpy,strbuf,xstrfmt,xsnprintf | NUL terminator |
| strncat | quadratic behavior |
定义宏移除方法
#define assert(x) (void)0关联信息
反向链接、本文链接的其他页面和外部资料。
References
GitHub2 条
- git/git/banned.hgithub.com/git/git/blob/master/banned.h
- git/git/commits/master/banned.hgithub.com/git/git/commits/master/banned.h