About struct in C

本文介绍了一个具体的rte_eth_conf结构体配置实例,该结构体用于定义以太网端口配置参数,包括接收模式、高级接收配置及发送模式等。通过对该实例的分析,读者可以了解到如何设置关键字段来实现特定的功能需求。

something new:

 to set value in struct can be 

in case i cannot view picture.. i write the snippet here ..

static struct rte_eth_conf port_conf = {
    .rxmode = {
        .mq_mode = ETH_MQ_RX_NONE,
        .max_rx_pkt_len = ETHER_MAX_LEN,
        .split_hdr_size = 0,
        .header_split = 0, /**< Header Split disabled */
        .hw_ip_checksum = 0, /**<IP checksum offload enabled */
        .hw_vlan_filter = 0, /**<VLAN filtering disabled */
        .jumbo_frame = 0, /**<Jumbo Frame Support disabled */
        .hw_strip_crc = 0, /**<CRC strip by hardware */
    },
    .rx_adv_conf = {
        .rss_conf = {
            .rss_key = NULL,
            .rss_hf = ETH_RSS_IP,
        },
    },
    .txmode = {
        .mq_mode = ETH_MQ_TX_NONE
    },
};

the dot punctuation means the member of the struct, that being used, member can be assigned without accordance to its order.

转载于:https://www.cnblogs.com/sansna/p/5684486.html

Description In programming language design circles, there has been much debate about the merits of "structural equivalence" vs. "name equivalence" for type matching. Pascal purports to have "name equivalence", but it doesn't; C purports to have structural equivalence, but it doesn't. Algol 68, the Latin of programming languages, has pure structural equivalence. A simplified syntax for an Algol 68 type definition is as follows: type_def -> type T = type_expr type_expr -> T | int | real | char | struct ( field_defs ) field_defs -> T | field_defs T In this syntax, T is a programmer-defined type name (in this problem, for simplicity, a single upper case letter). Plain text symbols appear literally in the input, and zero or more spaces may appear where there are spaces in the syntax. Algol 68 type equivalence say that two types are equivalent if they are the same primitive type or they are both structures containing equivalent types in the same order. Input Input consists of several test cases. Each test case is a sequence of Algol 68 definitions, as described above, one per line. A line containing "-" separates test cases. A line containing "--" follows the last test case. Output The output for each case will consist of several lines; each line should contain a list of type names, all of which represent equivalent types. Each type name should appear on exactly one line of output, and the number of output lines should be minimized. The names in each list should be in alphabetical order; the lines of output should also be in alphabetical order. Output an empty line between test cases. 输入数据 1 type A = int type B = A type C = int type X = struct(A B) type Y = struct(B A) type Z = struct(A Z) type S = struct(A S) type W = struct(B R) type R = struct(C W) -- 输出数据 1 A B C R S W Z X Y,写cpp解决这道题
05-28
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值