9

I just found this comment declaration in some xcode sample project:

/*!
@property masterVolume
@abstract Sets the master volume
*/
@property float masterVolume;

The comment is green as usual, the @property and @ abstract are dark green. If I remove the exclamation mark, they have the same green. What’s the purpose of the exclamation marks?

sideshowbarker
  • 81,827
  • 26
  • 193
  • 197
Faser
  • 1,256
  • 1
  • 18
  • 36
  • 1
    Related to http://stackoverflow.com/questions/6605535/what-are-documentation-comments-in-xcode ? – Cyrille Oct 10 '11 at 15:35

3 Answers3

6

To make transition from headerdoc a bit simpler, appledoc (tool to generate documentation from code so you save time in documentation) also accepts headerdoc style multiline comments:

/*! Comment */

Source

Andre Holzner
  • 18,333
  • 6
  • 54
  • 63
Farrukh Subhani
  • 2,018
  • 1
  • 17
  • 25
  • So basically, if I have appledoc, that is going to use that comment to write a documentation? nice :) – Faser Oct 10 '11 at 16:38
3

In Objective-C, a comment is only delimited by /* */, so you are right, the exclamation point is not necessary to form a comment. However, in this case, the ! there is to say that that commment should be read by an auto-documentation tool, such as Doxygen or AutoDoc. The same goes for the @ symbols there. @property is saying that you are documenting a property called masterVolume and @abstract is describing what the property is for.

DeM0nFiRe
  • 185
  • 4
3

It's a Qt comment style. It is treated as a block comment by doxygen, Headerdoc, and Appledoc. The author was familiar with Qt programming and chose that comment style. He could have chosen /** instead, just a matter of taste.

albert
  • 8,285
  • 3
  • 19
  • 32
Jano
  • 62,815
  • 21
  • 164
  • 192