鍍金池/ 問(wèn)答/C  網(wǎng)絡(luò)安全/ c語(yǔ)言中結(jié)構(gòu)體的聲明?

c語(yǔ)言中結(jié)構(gòu)體的聲明?

在C 代碼中經(jīng)??吹?"struct xxx;" 這種代碼, libusb.h中 的struct libusb_device來(lái)說(shuō), 如下面所示:
圖片描述

這是什么意? 只是一個(gè)聲明嗎? 但是在這個(gè)文件中根本找不到 struct libusb_device 的定義, 因?yàn)閘ibusb.h文件include的都是系統(tǒng)標(biāo)準(zhǔn)的頭文件, 不可能有這個(gè)結(jié)構(gòu)體的定義啊, 求解釋, 謝謝!
完整的libusb.h 文件在這里:liusb.h

回答
編輯回答
淚染裳

This is just called Forward declaration

refer this: http://en.cppreference.com/w/...

2017年9月1日 04:31
編輯回答
陪我終

我?guī)湍惆稍创a都下下來(lái)了.....找到了定義的地方,這里應(yīng)該是聲明
文件:libusbi.h

struct libusb_device {
    /* lock protects refcnt, everything else is finalized at initialization
     * time */
    usbi_mutex_t lock;
    int refcnt;

    struct libusb_context *ctx;

    uint8_t bus_number;
    uint8_t port_number;
    struct libusb_device* parent_dev;
    uint8_t device_address;
    uint8_t num_configurations;
    enum libusb_speed speed;

    struct list_head list;
    unsigned long session_data;

    struct libusb_device_descriptor device_descriptor;
    int attached;

    unsigned char os_priv
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
    [] /* valid C99 code */
#else
    [0] /* non-standard, but usually working code */
#endif
#if defined(OS_SUNOS)
    __attribute__ ((aligned (8)));
#else
    ;
#endif
};
2018年8月13日 04:17