Need Expert C answer

This is not a problem but a question of you C experts. I am trying to use Keil tools so I thought I would start here.
The following typedef is declared in a header file that is included in a header file that is included in a header file that is included in a header file about five deep.
My question is basic C. Why would the programmer use
a struct of one uint16?
I can understand a callback to define a table of records in non-volatile memory. Don't ask me how the programmer planned to use this code. It's not used anywhere!

typedef struct
{ uint16 numRecs;
} nvBindingHdr_t;

By the way, the code is from Texas Instruments Z-Stack
for their ZigBee CC2530 devices.
Please educate me a bit.
Bradford

Parents
  • a question of you C experts.

    Actually, no, it's not. It's a question about the data structure design of an (apparently somewhat involved) piece of software. The fact that it's expressed in C syntax is quite irrelevant.

    Why would the programmer use a struct of one uint16?

    That's strictly impossible to tell from such a microscopic fragment. You're basically asking for a mind reading of a person neither you or us has likely ever met.

    As-is, the only conclusion to be drawn from this fragment is that somebody might have over-done the abstraction or data-hiding a bit.

Reply
  • a question of you C experts.

    Actually, no, it's not. It's a question about the data structure design of an (apparently somewhat involved) piece of software. The fact that it's expressed in C syntax is quite irrelevant.

    Why would the programmer use a struct of one uint16?

    That's strictly impossible to tell from such a microscopic fragment. You're basically asking for a mind reading of a person neither you or us has likely ever met.

    As-is, the only conclusion to be drawn from this fragment is that somebody might have over-done the abstraction or data-hiding a bit.

Children
More questions in this forum