There is no need to command G40 before switching compensation.
If you do decide to insert G40, lead-in/lead-out moves would need to be cared about.