当前位置: 动力学知识库 > 问答 > 编程问答 >

Only one member variable in the structure

问题描述:

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.

分享给朋友:
您可能感兴趣的文章:
随机阅读: