问题描述:

I recently come across a structure type given below:

typedef struct AcslHostReq

{

uint16 templateId;

} AcslHostReq_t;

There is only one member variable in it. What is the reason of making it structure?

网友答案:

Although a single member in a struct does not add useful functionality over using the single member itself instantaneously, it might be a matter of typing, design and maintainance. Once a larger implementation is set up, the struct can be extended adding other members without changing other types and function signatures based on it. If only the single member would have been used, other parts of the implementation would have to be changed.

相关阅读:
Top