2 ms·
0xAA, 0xA5, 0x5A, 0x55 are generally good values. They tend to be low-probability values so if you get two of them together it's almost always a bug. They don
by bsder 8y ago
0xAA, 0xA5, 0x5A, 0x55 are generally good values.
They tend to be low-probability values so if you get two of them together it's almost always a bug. They don't tend to collide with other things and are far enough away from overflow that they don't accidentally get masked by an off-by-one bug. They have interleaved 0's and 1's so that if you get a bit error, it sticks out. They're also obviously different enough that if they get copied, they kind of stick out.
I tend to "initialize" my data to these by default. They also tend to be my go to for "deinitializing" data.
It's remarkable how often I catch bugs in my C code simply by scanning RAM for those values.