I've had a personal distaste for many years for many "old school" conventions of slaying, say, a village of goblins, just because they're evil. Is it considered to be just for "heroes" to slaughter them all? Is it right to never offer quarter to sapient foes, but rather barge into a dungeon room with swords drawn? etc.Generally, I don't give a lot of consideration to questions of this sort, because, in my experience, they're often insincerely asked. That is, they're really a cover for a hidden agenda of some sort, including (but not limited to) a general indictment of D&D and/or swords-and-sorcery gaming generally.
Personally, I can really only enjoy hack-n-slash if there's either a strong moral compass for the heroes (requiring those who follow good to offer quarter, not taking lives needlessly, etc.), or if those the heroes act against are by definition irredeemably evil (demons, devils, undead, Cthulhu-esque horrors, etc.). But I admit I'm weird and don't judge other viewpoints... and it's not like I'm consistent in this view. (I don't like heroes killing orcs just because they believe they're evil, but I don't think a player of the Russian side in Axis & Allies is tacitly approving of Stalin's actions.)
In this case, though, the question included reference to a moral compass, something I've previously commented upon as a necessity in D&D. Indeed, my feeling remains that the game implicitly holds to a rather traditional moral structure derived from a kind of "fairytale Christianity" that partly provides a counterbalance to the game's other, more unsavory implications -- but only partly.
That's because D&D has never been a systematic game, particularly in its inspirations. While pulp fantasy writers like Howard, Leiber, and Vance, none of whom were much concerned with "moral" questions, are the game's primary influences, they're not its only ones. Both Gygax and Arneson were interested in medieval history and its events, both real and legendary, also loomed large in their imaginations. It's from here that deviations from the comparative amorality of pulp fantasy entered the game, aided no doubt by the authors' own moral beliefs. The end result is a game with some very muddled moral stances, complicated by the fact that many of D&D's internal mechanisms, such as alignment, contributed to rather than dispelled its muddled state.
This moral confusion was made worse by the fact that in most traditional swords-and-sorcery literature, there aren't a lot of "monsters," let alone intelligent ones. The enemies against whom Conan or Fafhrd and the Gray Mouser fought, for example, were generally other human beings, none of whom were portrayed as evil by nature. They were enemies because they opposed the protagonists, not because of what they were. D&D, though, borrowed many surface elements from high fantasy writers like Tolkien, elements that, when stripped of their larger context, don't mesh well with the pulp fantasy superstructure of the game.
Thus, the importation of the irredeemably evil orcs -- and the extrapolation by Hit Dice of other related races -- introduced a wrinkle into the implied setting of the game that it couldn't easily contend with. Whereas Conan's slaying of an individual man could be potentially be justified on the basis of the individual's actions, humanoid monsters don't seem to enjoy that same status. They're evil because they are evil and no further justification is needed. Tolkien himself seemed to waver on this point later in life, but D&D, for most of its existence, has not. Add to this the naturalistic presence of non-combatant females and young, and you have the recipe for some very thorny questions that D&D's incoherent moral structure just can't handle.
I say that not as a criticism of Dungeons & Dragons. I don't personally have any problems with this incoherence, mostly because it's precisely this that makes the game so accessible and malleable to many tastes. But there's no denying that the incoherence is there and that, without some thought on the part of the referee (not to mention the cooperation of his players), the game can quite easily degenerate into something that some might view as indefensible from a moral point of view.
Again, let me stress that I'm not saying that this has to be the case or even that it's much of an issue for me personally. I've dealt satisfactorily with these matters in my own campaigns, but doing so required that I deal with them. I don't recommend making them the focus of one's campaign (or one's thoughts about it), but I also think avoiding them isn't viable in the long term. Or at least it's never been so for me. I much prefer to address moral questions head on, even in RPGs, and it's precisely this that I think too many referees don't do, thereby lending ammunition to those who would argue there's something inherently immoral about swords-and-sorcery. That's why, like Steven Marsh, I think a moral compass of some sort is needed to combat this false accusation.