Protecting Booleans against Soft Errors
Booleans represent the simplest and one of the most common data types. Although they are often critical, the traditional representation is ill-protected against transient faults, even though it already carries space overhead. Flipsafe is a C++ library of different Boolean types with improved fault tolerance and little performance overhead.
#include <epbool> // include Boolean type void control_app() { epbool<> secure = 0; // changed variable declaration while (wait_for_input()) { if (is_button_pressed() && secure) { open_door(); } else if (is_switch_pressed()) { secure = !secure; } } }