I have several struct: edge, vertex, graph in my library. I want to hide body of that structs from user (user have to use API), so in header file (eg. edge.h) I ve just put:
typedef struct edge edge_t;
And definition of edge struct is in edge.c
struct edge {...};
这种做法是完美的,但我不想从我自己的法典中掩盖结构。 我想在前线使用:c
vertex_t v;
v.some_attribute = x;
Now I get dereferencing pointer to incomplete type errors, is it possible to fix that? Is there any other option that use accessors (like user) for all struct elements?