Hacker News new | past | comments | ask | show | jobs | submit login

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, [...]}




Let 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




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: