什么是C语言怪异的用法 [英] what is the weird usage in C language

查看:160
本文介绍了什么是C语言怪异的用法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这几天我一直在阅读了dhcpd源$ C ​​$ C,其中有许多下面这种用法重新presented,我不明白这是什么...

发生了什么事时,结构包*包; 帕拉姆列表和 {之间?

  INT locate_network(数据包)
结构包*包;
{
    结构iaddr IA;
    结构data_string数据;
    结构子网*子网=(结构子网*)0;
    结构option_cache * OC;    如果((OC = lookup_option(安培; agent_universe,分组>选项,
               RAI_LINK_SELECT))== NULL)
    OC = lookup_option(安培; dhcp_universe,分组>选项,
               DHO_SUBNET_SELECTION);
    // .........
}


解决方案

这是老K&放大器;函数声明中的R风格,由ANSI风格,你可能更熟悉取代。另请参见函数声明:K&安培; R VS ANSI

these days i have been reading the dhcpd source code in which there are many such usage represented below,i don't understand what that is...

what happened when the struct packet *packet; between the param list and the { ?

int locate_network (packet)
struct packet *packet;
{
    struct iaddr ia;
    struct data_string data;
    struct subnet *subnet = (struct subnet *)0;
    struct option_cache *oc;

    if ((oc = lookup_option(&agent_universe, packet->options,
               RAI_LINK_SELECT)) == NULL)
    oc = lookup_option(&dhcp_universe, packet->options,
               DHO_SUBNET_SELECTION);
    //.........
}

解决方案

That's the older K&R style of function declaration, superceded by the ANSI style you are probably more familiar with. See also Function declaration: K&R vs ANSI

这篇关于什么是C语言怪异的用法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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