Coming from a firmware background with code running for a long time, limited memory protection, potential for memory corruption due to hardware bugs, I have learned a lot of defensive programming techniques like fencing structs with magic numbers, checksums, duplicated fields. Even unused bits of struct bitfields are set to magic values, all to help catch source of rare corruptions while debugging and hardening the code.