块注释开头的感叹号的作用是什么? (即“/*!”*/“)
我刚刚在一些xcode示例项目中发现了这个注释声明:
/*!
@property masterVolume
@abstract Sets the master volume
*/
@property float masterVolume;
注释像往常一样是绿色的,@property和@abstract是深绿色的。如果我去掉感叹号,它们就会有相同的绿色。感叹号的目的是什么?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
为了使从 headerdoc 的转换更加简单,appledoc(从代码生成文档的工具,以便您节省文档时间)还接受 headerdoc 样式的多行注释:
来源
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:
Source
在 Objective-C 中,注释仅由 /* */ 分隔,所以你是对的,形成注释不需要感叹号。然而,在这种情况下,!据说该注释应该由自动文档工具(例如 Doxygen 或 AutoDoc)读取。那里的@符号也是如此。 @property 表示您正在记录一个名为 masterVolume 的属性,而 @abstract 则描述该属性的用途。
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.
这是Qt注释风格。 doxygen 将其视为块注释,Headerdoc 和 Appledoc。作者熟悉Qt编程并选择了这种注释风格。他本可以选择
/**
,这只是一个品味问题。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.