为什么使用“strlen30()"?而不是“strlen()"?

编程入门 行业动态 更新时间:2024-10-28 08:29:43
本文介绍了为什么使用“strlen30()"?而不是“strlen()"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我已经阅读并想知道sqlite的源代码

I've read and wondered about the source code of sqlite

static int strlen30(const char *z){ const char *z2 = z; while( *z2 ){ z2++; } return 0x3fffffff & (int)(z2 - z); }

为什么使用 strlen30() 而不是 strlen()(在 string.h 中)??

Why use strlen30() instead of strlen() (in string.h)??

推荐答案

提交消息 包含此更改状态:

[793aaebd8024896c] 部分签入 [c872d55493] 永远不要使用 strlen().使用我们自己的内部 sqlite3Strlen30() 保证永远不会溢出整数.额外的显式转换以避免令人讨厌的警告消息.(CVS 6007)(用户:drh 分支:trunk)

[793aaebd8024896c] part of check-in [c872d55493] Never use strlen(). Use our own internal sqlite3Strlen30() which is guaranteed to never overflow an integer. Additional explicit casts to avoid nuisance warning messages. (CVS 6007) (user: drh branch: trunk)

更多推荐

为什么使用“strlen30()"?而不是“strlen()"?

本文发布于:2023-07-30 00:48:19,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1245063.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:而不是   quot   strlen

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!