c - difference between 2 different implementations of declaring structures -
gcc 4.4.4 c89 i wondering real difference between following 2 implementations of defining structures?
channel.h file struct channel_tag; struct channel_tag* init_channel(size_t channel_id); void dispose_channels(struct channel_tag *channel); channel.c file typedef struct channel_tag { size_t channel_id; } channel_t; =================== second implemenation ===============
channel.h file typedef struct channel_tag channel; channel* init_channel(size_t channel_id); void dispose_channels(channel *channel); channel.c file struct channel_tag { size_t channel_id; }; many suggestions,
in first case have 1 data type, , second have 2 (where 2nd typedef'ed first). there no difference in generated code. many people more convenient read/write code omits struct keyword.
Comments
Post a Comment