Closed p-h-a-i-l closed 5 years ago
255 would not fit in a message?
well, if we use char, you are limited for sure to 255. Also the whole message handling is limited to a smaller payload.
maybe a macro around the sizeof() which reports a compile error if the result is > 253 ish? I'm not great at complex #defines :) - and don't know if you can cause such things as part of a structure definition.
All the macros I found were not satisfying and hard to understand.. This is my proposal: https://github.com/bipropellant/hbprotocol/pull/17
I think we should change
char len; // length of value
in tag_PARAMSTAT to int. This way we can check, if somebody wants to use a variable which exceeds our size.My favourite solution would be to throw an error during compilation. At runtime it's hard to alert the user. Maybe intentional crash?