According to the answers to this question, code formatting should only be used for code. The obvious cases where code formatting is appropriate are parts of actual code, such as variables or functions. Code formatting can also be used for command line commands or file names.
Cases where it's not appropriate are random keywords in the text, such as programming language names, framework names or operative system names. Here is an example of what you shouldn't do (taken from here):
I am having a difficult time with a background task
in iOS
. The problem I seem to be facing is that iOS
is silently terminating the App if my background task
runs for too long. What can I do to increase time iOS
will wait for my background task
to complete?
The rule I usually set myself about the use of code formatting is to format things as code only if you're referring to something that a computer can understand (your compiler or interpreter understands variable names and function names, Windows Explorer understands file paths, cmd.exe understands command line commands, etc). If you write C++
in your code or in the command line, your computer won't understand it, so you shouldn't use code formatting for it (unless you have a variable named C
that you want to increment, but that's something completely different).
It can happen that names of libraries, frameworks or programming languages are valid code. For example, you can run Python in cmd.exe by typing python
. In cases like this, you should only format it as code when you're referring to the actual code, not to the name (for example "What happens if I type python
in the command line?" is OK, but "I'm learning Python
and need some help" isn't).