Using Facebook Infer Static Analysis for Loop Invariant Function Hoisting

Learn and watch a video about how Facebook Infer static analysis will detect loop invariants, with an example of how to correct this issue.

We just released another short video for our free series on the Infer static analysis tool:

We cover an example that Facebook Infer would flag and warn you about. The idea is that you want a loop to be as efficient as possible and if you find a function that's being called repeatedly with the same result (a.k.a. an invariant), it can be safely hoisted outside of the loop.

You can read more about this at the Facebook Infer documentation site: https://fbinfer.com/docs/all-issue-types#invariant_call