Depending on your application domain, but if the software has timers and clocks I bet what I'm going to say applies, the good strategy is to use domain specific languages which offer strong guarantee on the produced code. Here I'm thinking specifically of synchronous dataflow languages. Those are formally defined and are designed for critical real-time system. They come with formal verification tools (often, model checkers) adapted to their semantics.
Lustre, Esterel, and Signal, are such languages.