Including .cpp analogy follows:
I could drink a bottle of poison (not intending to commit suicide) knowing that it was poison. That's not illegal, but it's pretty dumb.