redefinition of typedef

前端 未结 7 1003
北荒
北荒 2020-12-15 05:54

I am possibly doing this incorrectly and this is much a question about why it works in one compiler and not the other.

I have a large C application, and I am

7条回答
  •  长情又很酷
    2020-12-15 06:10

    Just as a matter of style I would put the typedef after the struct. i.e.:

    struct B_ {
        int c;
    };
    typedef struct B_ B;
    

    That way you are saying: "here is B_ and now I want to refer to it as B". It could be that the other way around fools something in the compiler.

提交回复
热议问题