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?

1

3 Answers 3

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

1
  • So basically, if I have appledoc, that is going to use that comment to write a documentation? nice :)
    – Faser
    Oct 10, 2011 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.

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.