Program info; conventions, am I doing it right?
Adding file information to 开发者_如何学Goa 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.
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.
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:
/**
* Stack overflow question!
* Copyright (C) 2010 Kyle <contact@kyle.com>
* Date: 9-29-2010
*/
精彩评论