There's an interesting article here
One of the things it says is: "There are circumstances when swearing is deeply satisfying, the kind of swearing I call cathartic swearing. I believe a lot of it goes back to a rage reflex that we inherited from other mammals. When an animal is suddenly confined or injured it will erupt in a furious struggle and emit an ear-piercing yowl. In the case of humans, that vocal impulse ties into our language system so we articulate our yowl with words we usually inhibit ourselves from saying."
It made me think of Mark Billingham's comments in the introduction to the new anthology, Expletive Deleted
"But…if knowing full well what the subject matter of such books is, you are still shocked and disgusted by a little bad language, then frankly you are an idiot, whose sense of values is way overdue for a service. Just how skewed does your worldview have to be, before you find it acceptable to read about death and dismemberment but are offended if those who come close to it swear now and again? Or go home and have a drink to cope with the trauma? Or, heaven forbid, sleep with someone they haven’t known for very long?"