节目信息;惯例,我做得对吗?
将文件信息添加到程序中。
/**
* @Author: Kyle
* @Date: 9-29-2010
* @Description: Stack overflow question!
*/
我这样做对吗?我有一个 C 编程课程,并且我一直在用类似的东西编写我的程序。
另外...我应该在哪里包含文件的版本信息?我会将其包含在日期下吗?
/**
* @Author: Kyle
* @Date: 9-29-2010
* @Version: 1.000
* @Description: Stack overflow question!
*/
正确的约定是什么?谢谢。
Adding file information to a program.
/**
* @Author: Kyle
* @Date: 9-29-2010
* @Description: Stack overflow question!
*/
Am I doing this right? I have a C programming course and I've been authoring my programs with something similar to that.
Also... Where would I include version information for a file? Would I include it under the date?
/**
* @Author: Kyle
* @Date: 9-29-2010
* @Version: 1.000
* @Description: Stack overflow question!
*/
What are the proper conventions? Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
只要您提供所有信息并保持所有代码之间的格式一致,就没有每个程序员都使用的真正约定。
听起来您使用了某种 doxygen 格式,但是我很确定它不接受使用“@”的文件开头的数据。
就我个人而言,我会删除“@”以使浏览程序员更清楚,但这只是我。如果您确实需要稍后重新格式化它以符合其他一些文档生成程序,那么如果您坚持某些东西,那么只需编写一个程序将源代码转换为所需的格式即可。我很确定这些程序中的很多都可以修改以更改它们使用的格式。
有些人为他们的所有代码文件添加了许可证,但就我个人而言,我让我的项目不包含所有这些内容,并在发布它们之前使用自动化程序来填充它们。
所以最终的答案是,使用对你来说清晰且恒定的东西。
Theres no real convention that every programmer uses, provided you give all the information and keep the format consistent between all your code.
It sounds like your using some kind of doxygen format, however I'm pretty sure that it doesn't accept data at the start of files using '@'.
Personally, I would remove the '@'s so as to make it clearer to the browsing programmer, but thats just me. If you really need to reformat it later to comply with some other documentation generating program then if you do stick to something, it'll be simply to write a program that converts your source code to the required format. I'm pretty sure a lot of those programs can be modified to change what format they use as well.
Some people put a license all their code files but personally I keep my projects free of all that and use an automated program to fill it in before I release them.
So final answer, use something thats clear and constant to you.
考虑将模块的简短描述作为注释的第一行。最好包含原作者的电子邮件 ID,以便将来的维护人员可以联系他。您可能还需要包含版权和许可信息:
Consider giving the short description of the module as the first line of the comment. It is a good practice to include the email id of the original author, so that future maintainers can contact him. You may also want to include copyright and licensing information: