为什么使用" strlen30()"? [英] Why use "strlen30()"?

查看:119
本文介绍了为什么使用" strlen30()"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

我看了,并想知道的SQLite源$ C ​​$ C。

I read and wondered about the source code of sqlite.

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

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

感谢您。

推荐答案

提交了去了这一变化的状态信息

[793aaebd8024896c]办理入住手续的一部分[c872d55493]从来没有使用strlen()。使用我们自己的内部sqlite3Strlen30(),它是保证永远不会溢出的整数。其它显式转换,以避免滋扰警告消息。 (CVS 6007)(用户:DRH分支:主干)

[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()"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆