+ -
当前位置:首页 → 问答吧 → FD_ISSET 的疑问?

FD_ISSET 的疑问?

时间:2010-06-28

来源:互联网

int FD_ISSET (int filedes , const fd set *set )                                     [Macro]
     This macro returns a nonzero value (true) if filedes is a member of the file descriptor
     set set, and zero (false) otherwise.
     The filedes parameter must not have side effects since it is evaluated more than once.

“The filedes parameter must not have side effects since it is evaluated more than once.” 这句没看明白? 这里所说的边际效应是什么? 凭什么测试多过一次,就不存在边际效应呢?

作者: peidright   发布时间: 2010-06-28

side effect是副作用的意思。
是说FD_ISSET是一个宏,因为filedes被多次求值,
因此它不能有副作用。

作者: lenovo   发布时间: 2010-06-29

回复 lenovo


    没太想明白,为什么多次求值,就没有副作用。。

作者: peidright   发布时间: 2010-06-29



QUOTE:
回复  lenovo


    没太想明白,为什么多次求值,就没有副作用。。
peidright 发表于 2010-06-29 00:21




    是要求你多次求值,不要(must not)有副作用。
你的英语需要锻炼。

作者: lenovo   发布时间: 2010-06-29

回复 lenovo


    汗,我的理解是“  不应该(must have not)有副作用, 因为它已经被多次测试求值。。

作者: peidright   发布时间: 2010-06-29