1

I know that the data-types supported by protobuf-c are restricted to the ones mentioned here , but what can be a good protobuf-c equivalent to the following data types in C

time_t, int8_t, int16_t, uint8_t, uint16_t, ushort

brokendreams
  • 827
  • 2
  • 10
  • 29

1 Answers1

1

For time_t, use uint64_t.

For all the others, use sint32_t (often negative), int32_t (rarely negative), or uint32_t (never negative). Protobuf uses a variable-width encoding for integers that avoids using more space on the wire than is really needed. For instance, numbers less than 128 will be encoded in 1 byte by int32_t.

Kenton Varda
  • 41,353
  • 8
  • 121
  • 105