This.
In any group you will need to agree on a set of rules about these things. A Code of Conduct doesn't change that, just makes it explicit.
The reason that Codes of Conduct are good is that it makes the life of an organiser so much easier. If Bob is being weird around the ladies (again), then an organiser can take him to one side and point to the "no being weird around the ladies" clause in the CoC. This is a massively easier discussion than without the CoC, where they would have to explain to Bob that his behaviour around the ladies was causing them distress, etc.
Yes, this includes "grey" areas, because it involves human feelings and emotions. Charles might behave in a similar manner to Bob, but not be "weird" about it, and people find him funny not creepy. Therefore he's not breaking the "don't be weird around the ladies" rule. That's down to human perception, unfortunately for Bob.
But that rule already existed, and was already "grey". Without the CoC, the organiser would still need to take Bob to one side and have the chat. Because weirding out the female members of the group is a dick move regardless. And Charles would still get a pass because he wasn't being weird. The CoC hasn't changed anything, just made it explicit.