免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1884 | 回复: 3
打印 上一主题 下一主题

[C] 有谁帮我看看这段代码,为什么先从函数中返回然后才设标志位。 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2007-11-02 16:42 |只看该作者 |倒序浏览
static int iface_read(char *page, char **start, off_t off, int count, int *eof, void *data)
{
        return read_all(page, count, eof, data, IFACE_LEN);
        /* Turn off the warnings and still get the same object file */
        off = 0; start = 0;
}
为什么先从函数中返回然后才设标志位?

[ 本帖最后由 winsty 于 2007-11-2 16:46 编辑 ]

论坛徽章:
0
2 [报告]
发表于 2007-11-02 17:17 |只看该作者
原帖由 winsty 于 2007-11-2 16:42 发表
static int iface_read(char *page, char **start, off_t off, int count, int *eof, void *data)
{
        return read_all(page, count, eof, data, IFACE_LEN);
        /* Turn off the warnings and still get the s ...

应该是该程序用的编译器比较严格,对未使用的参数也会警告。这样写用于避免编译器警告。

论坛徽章:
0
3 [报告]
发表于 2007-11-02 17:51 |只看该作者
原帖由 winsty 于 2007-11-2 16:42 发表
static int iface_read(char *page, char **start, off_t off, int count, int *eof, void *data)
{
        return read_all(page, count, eof, data, IFACE_LEN);
        /* Turn off the warnings and still get the s ...

改动了程序但又不想删除原来的代码,所以这些代码放在return后,他们永远都不会被执行

论坛徽章:
0
4 [报告]
发表于 2007-11-02 23:54 |只看该作者
受教了!
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP