4 ms·
0 and 1 can be magic if the context depends on them being arbitrarily 0 or 1. eg. // this byte is unused and always 0 #define UNUSED_CONSTANT_FIELD_VALUE 0 b
by loa_in_ 6y ago
0 and 1 can be magic if the context depends on them being arbitrarily 0 or 1. eg.
// this byte is unused and always 0
#define UNUSED_CONSTANT_FIELD_VALUE 0
bytes = {HEADER, UNUSED_CONSTANT_FIELD_VALUE, [...]}
- cratermoon 6y agoLet me tell you about the system where null and 0 are treated as equal because in some programming languages will coerce null to 0. It just so happens that for an important business type in this system: the range of the type is the non-negative integers up to (2^32)-1 semantically, the value cannot be null when the value is 0, the code treats it as a special case null is treated as 0