4

I have a header file. That file is filled with multi line comments. In comments there are many time some words appear with @ e.g

/** @that


*/

Now this "that" changes color from green to orange(in Keil IDE). These comments doesn't seem affecting anything. Is there any thing significant behind changing color of this text? Or this is just another thing about comments that I don't know, and it is harmless? Please note that when I remove one star behind "that", it changes color to green as well.

TRoa
  • 344
  • 5
  • 15
  • 9
    It's (most likely) part of a code documentation generator (looks like Doxygen). That is not part of the C language, it's an external tool – UnholySheep Nov 07 '18 at 08:05
  • 2
    There are tools which can go through your source and extract documentation from it, including special "tags" in comments. It is very likely that what you're seeing is such a special tag that will be handled such a tool. – Some programmer dude Nov 07 '18 at 08:06
  • 1
    It looks like this question (not saying it's duplicate, though) https://stackoverflow.com/questions/36192264 – Jean-Marc Zimmer Nov 07 '18 at 08:07
  • 1
    There are various annotation schemes using different markers in comments to provide extra structured information about the code. The `@` will be another. AFAICR, it works for [Doxygen](http://www.doxygen.org/manual/docblocks.html) — though the manual shows `@` with Python but not in C as far as I can see. (More accurately, the `/**` marks the start of a Doxygen comment block. The `@` notation will require more research.) – Jonathan Leffler Nov 07 '18 at 08:07
  • Please copy a complete example, not just "@that" – Antti Haapala -- Слава Україні Nov 07 '18 at 08:41
  • @JonathanLeffler @ works for any language. The usual default is \ but @ works just as well. – n. m. could be an AI Nov 07 '18 at 09:11

1 Answers1

6

It's not by chance that you see that in a header file, since it's related to documentation.

It is not part of the C language itself, like for example using /* for comments, but most of the times, it is used for annotating a function, or/and (as in your case) a parameter.

Example:

/**
 * @annotateThatFunctionAsInvokable
 * Add two integers
 *
 * @param   [in]    a    first addend
 * @param   [in]    b    second addend
 * @param   [out]   sum of 'a' and 'b'
*/
void add(int a, int b);

Note: C preprocessor pretty much ignores the contents of a comment, thus any annotations will be taken into account by the documentation tool only.

PS: A really wide used documentation tool is Doxygen, which in order to understand your documentation and parse it correctly, uses these @.

gsamaras
  • 71,951
  • 46
  • 188
  • 305