Unlike many swear words, the F-word is sexual. A case could be made for saying that its use constitutes sexual harassment.  The primary meaning of the F-word is sexual, so blurting it out in a lecture hall -- which presumably contains a handful of young women -- is not appropriate.  If any of them feel uncomfortable, they could make the prof's life pretty miserable: "I really can't attend class where the professor is continually talking about sex!!"