When one writes code in a question or answer, the live preview treats the # character as a comment.
Compare
with
The first is screenshot taken while asking a new question. The second is a screenshot taken of an existing answer.
And on meta, there is no formatting at all.
\def\foo#1{xxx}