With the Ricky Gervais debate rumbling away (see Steven Baxter's take here ), it seems that the question of comedy and "offence" is a perenially fascinating one. I interview quite a lot of comedians and comedy writers -- fittingly, because they are one of the few groups of celebrities willing to say something "risky" (ie interesting) -- and the subject inevitably comes up.
Reginald D Hunter puts his approach this way : "With comedy, you can talk about anything you like. The deftness lies in how you talk about it. If a joke moves you, then work backwards and find a way to say it to uptight people who want to hear it but don't have the nerve to admit it."
Graham Linehan has a similar belief, admitting  that he relishes finding ways to tackle taboo subjects (such as the cannibal murderer). "These days, I think: "If the person I was making fun of contacted me, would I be able to defend it?" If the answer is yes, I go ahead. If the answer is no, I ask myself if I like the person. If the answer to that is no, I go ahead," he says."
Russell Howard's way of looking at the subject is perhaps the simplest : "The test I always like to do is: would I do that in front of the person? If I wouldn't, I won't say it."
I thought I'd collect some of the best articles I've read on the subject:
1. David Mitchell and Hitler
Mitchell's is hardly the first name you'd think of when drawing up a list of offensive comedians, but he had a spot of bother over suggesting  that the last entry in Anne Frank's diary read: "It's my birthday and dad bought me a drum kit."
He recently wrote a superb article  about the ban on doing mock-Hitler salutes next to a waxwork of the dictator in Madame Tussauds, noting: "There are always evil, oppressive forces at work on any society but they'll be found wanting in guile if they come at us goose-stepping and shouting "Sieg Heil!" for a second time. The only thing that could make that seem attractive or worth following, even to an idiot, is if it were banned."
2. Richard Herring vs Ricky Gervais
Herring is hardly prudish (I watched one of his stand-up routines that included a long digression on whether Jesus might have used his stigmata for, er, bedroom purposes), but he's firmly in the anti-Gervais/mong-is-just-a-word-now camp. On his blog , he writes that disablist words "do equate with those racial and homophobic epithets that are rarely heard these days. They do confirm the stereotype of disabled people and contribute to their further isolation in a world that already tries to pretend they don't exist."
3. Jimmy Carr and the amputees
Carr regularly pushes the boundaries, and recently got in trouble over a 9/11 joke on Twitter. But in 2009, he got Daily Mailed for this joke: ""Say what you like about these servicemen amputees from Iraq and Afghanistan, but we're going to have a fucking good Paralympic team in 2012." Bruce Dessau defends him in the Guardian here  and David Mitchell (yes, him again) does so here. 
Mitchell writes: "The media are so hungry for stories about how offensive we are and so quick to call for us to be banned from channels or resign that it's tempting to play it safe, to surrender to the prevailing tone of judgmental solemnity."
4. James Ward vs Ricky Gervais
Fight funny with funny. Here , James Ward spins off a superb riff about "reclaiming" the word Gervais. "Even with the most generous of explanations (that he is somehow challenging our attitude to disability), he comes across like a clumsy, clueless, insensitive prick. There is a word for someone who engages in this sort of behaviour online, that word is "troll". I suggest a new word: "Gervais". He can't object, after all, it has a new meaning now."
5. Stewart Lee and political correctness
As one of the writers of Jerry Springer: The Opera, Lee has been on both sides of the offence debate. Unsurprisingly, his contributions on the subject are appropriately nuanced. Here , he defends Borat, The Office and the "comedy of shock, bad taste and outrage", while in his stand-up set , he argues in favour of "political correctness".
I'll add more as I think of them (there's a Louis CK routine that I'd like to hunt down). In case you're interested, my own view is closest to that expressed by David Mitchell -- you can joke about any subject; it's the target of the joke that matters. I went to see Frankie Boyle's live show when he was on Mock The Week, and enjoyed it, but after his joke on Tramadol Nights about Katie Price's son Harvey, I thought: "I don't want to give you any more of my money." And that's how we vote on comedy -- with our wallets and our remote controls.