API

共 7 篇文章。

fgetc()返回值是int而不是char

• Development

其实是个很简单的常识,居然搞了我半个小时……

fgetc()的返回值是int,因为这个值除了返回拿到的字符之外,还兼作错误标志。由于fgetc()允许文件中包含任意内容,所以只好增大返回值的宽度来表达。

阅读全文… ( 本文约 135 字,阅读大致需要 1 分钟 )

搞坏了inet_ntoa_r API

• Kernel

看来还是学的太少了。之前只是注意到内核有提供这样一个接口,等到kris来信才知道,这个接口和其他平台上都不一样-_-#

参与评论

龌龊的dirname(3)定义

• Development

在POSIX中提到,这个API不仅可以修改输入参数,而且可以返回一个静态存储的指针,说白了,你不能指望某个平台上它是线程安全的,也不能指望它不会修改你发给它的数据……

参与评论

重新设计了d的一组API

• Development

将个性化的factory提取出来,改为使用通用的factory生成同一协议的protocol对象,并将业务逻辑对象作为factory的一个参数。这样做使得代码冗余大大降低了。

参与评论

My misunderstanding of OpenLDAP API

• Development

I used to think that ldap_unbind() is the opposite of ldap_bind(), however I was wrong. Pierangelo Masarati (ando at openldap) pointed out that it was actually opposite of ldap_init(). So, do NOT expect init() -> bind() -> search() -> unbind() -> bind() would success, it’s simply wrong thing. You do not need to unbind() before you do another bind().

Just make a note.

参与评论