I never did as a child, but I do now occasionaly, and my parents are comfortable to swear in front of me too. But sometimes I'll still get told off if I'm being a bit excessive.
If you swear while in pain (think icy cold/burning hot) then it will increase your pain tolerance and let you cope better or put up with it longer.
The theory is that saying something you find naughty releases small amounts of adrenaline (from the thrill of being heard swearing) which helps you tolerate the pain.
But if you're emotionally desensitised to swearing, from using it regularly, then swearing will have less effect on pain. You would have to resort to using your own personal taboo words.