The “I” in IDA stands for interactive, and one of the most common interactive actions you can perform is adding comments to the disassembly listing (or decompiler pseudocode). There are different types of comments you can add or see in IDA.
These comments are placed at the end of the disassembly line, delimited by an assembler-specific comment character (semicolon, hash, at-sign etc.). A multi-line comment shifts the following listing lines down and is printed aligned with the first line which is why they can also be called indented comments.
Shortcut: : (colon)
Basically equivalent to regular comments with one small distinction: they are repeated in any location which refers to the original comment location. For example, if you add a repeatable comment to a global variable, it will be printed at any place the variable is referenced.
Shortcut: ; (semicolon)
A repeatable comment added at the first instruction of a function is considered a function comment. It is printed before the function header and — since it’s a repeatable comment — at any place the function is called from. They’re good for describing what the function does in more detail than can be inferred from the function’s name.
Shortcut: ; (semicolon)
Anterior and posterior comments
These are printed before (anterior) or after (posterior) the current address as separate lines of text, shifting all other listing lines. They are suitable for extended explanations, ASCII art and other freestanding text. Unlike regular comments, no assembler comment characters are added automatically.
Shortcuts: Ins, Shift–Ins (I and Shift–I on Mac)
Trivia: the comment with file details that is usually added at the beginning of the listing is an anterior comment so you can use Ins to edit it.
In the decompiler pseudocode you can also add indented comments using the shortcut / (slash) and block comments using Ins (I on Mac). They are stored separately from the disassembly comments, however function comments are shared with those in disassembly.
In some situations IDA itself can add comments to disassembly. A few examples:
“Auto comments” in Option > General.., Disassembly tab enables instruction comments.
Demangled names are shown as auto comments by default. Use the Options > Demangled names… dialog if you prefer to replace the mangled symbol directly in the listing.
String literals work similarly to repeatable comments: the string contents shows up as a comment in the place it’s referenced from.