|
|
|
|
|
by AnimalMuppet
963 days ago
|
|
To the degree that you were worried about such things, this wasn't a real answer. Yes, it saves you if you have a boolean variable... maybe? if (var == TRUE)
; // It was 7
else if (var == FALSE)
; // it was zero
else
??? what do I do here?
And you need to solve that "what do I do here" for every single conditional on a boolean, and have the extra lines of code to handle it and not crash.But, you know, what if it was a variable that you used in a switch statement instead? Or just "if (i > 17)"? Bit flips can affect your logic all over the place, not just when it's a boolean variable. And then, if a bit flip can affect a boolean, it can also affect a pointer. Or the return address on the stack (or the link to the previous stack frame). Or it can flip a bit in the code. So this is, at best, a very very partial solution, and it's non-trivial to implement. So this was very much not standard practice or a "convention". |
|
Any team that realizes that the compiler may choose to optimize out a shit-ton of such code gets an extra gold star.