Please see the attached figure to see my problem.
Your observation is correct. I got the same output after writing the two lines from your example.
I kept getting a similar thing happening when using the angular brackets for code, I think disabling html should resolve the issue.
Perhaps the forum maintainer should disable html for all text within code tags if such a thing is possible.
If you disable the default HTML setting in your your profile (Always allow HTML: No), you will be able to hande this feature for any post using a check box below the text area.