gulachek / msgstream

Send messages over file descriptor streams in C
0 stars 0 forks source link

Header size should be `uint8_t` #3

Open gulachek opened 1 month ago

gulachek commented 1 month ago

The header size is bounded by 9 bytes, and in fact, part of the protocol is defined by it being a single byte. Enforce this by typing it as a uint8_t.

gulachek commented 1 month ago

The only argument I could see is that we have room to extend the header size to use a zig-zag encoding (or whatever it's called with the leading bit continuing a base 128 number). By keeping size_t, doing that wouldn't require callers to change. But do we really expect a message of size greater than 2^256? That seems way too big to ever support for a messaging protocol.