Not necessarily and it may affect the acidity of the soil
If you cover the surface of the compost with a 1cm-thick mulch of gravel, grit or ornamental glass pebbles, this will stop house plant flies from being able to lay their eggs.
Wouldn't it be better to stop the house flies getting into your home in the first place Ric.ror? I hate them and have fly screens at patio doors and windows.