DataType equivalent in Protobuf

1k views Asked by At

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

1

There are 1 answers

0
Kenton Varda On

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.