刚入司时,给我们做技术培训的老员工强烈向我们推荐blog这个新兴(起码对我来说是新的^_^)的咚咚,当时也想写就申请了一个,可是不知一天都忙些什么了,到今天才写了这第一篇,要说今天为什么要写,两个字“心烦”,本来我的第一篇blog在我的头脑中早已构思多次了,内容也换了多次,可是都没能实现,这篇blog是在丝毫没想的前提下动手写的。我觉得这样也不错,现在我的感觉就是想写就写,不用考虑太多,呵呵。

今天我入司以来的第一个项目编码结束,上午代码评审,我的leader给我找出“一堆”问题。真是郁闷啊,原以为自己的水平可以了,原来还是有很多要学习的。以前在Windows平台上开发,早已有自己的规范或者说习惯。现在转移到Solaris上开发,有些东东还真得好好学习一下,比如C语言代码头文件和源文件的格式。下面的例子是从各个代码规范中提取出来的一部分,也是我以后在项目中要使用的形式,有可能只适合我,呵呵。

本不是第一篇的第一篇,我就写这么多了。

附代码规范示例:

/* in ANSI_C_CODING_STANDARDS.h */

/*

* Copyright 2005, XX, Inc., China

* All rights reserved.

*

* XX’s source code is an unpublished work and the use of a copyright notice does

* not imply otherwise. This source code contains confidential, trade secret material of

* XX, Inc. Any attempt or participation in deciphering, decoding, reverse engineering

* or in any way altering the source code is strictly prohibited, unless the prior written

* consent of XX, Inc. is obtained.

*/

/*

* @file ANSI_C_CODING_STANDARDS.h

* @author tony_bai

* @date 2005-07-01

* @brief the template for ANSI C

*        header file

*/

/*

* @revision

*   @version 0.1

*   @date 2005-08-01

*   @Revisor tony_bai

*

* @revision

*   @version 0.2

*   @date 2005-09-01

*   @Revisor tony_bai

*/

/*

* @glossary

*   xx – xxxxx

*   xx – xxxxx

*/

/*

* @usage

*

*/

#ifndef ANSI_C_CODING_STANDARDS_H

#define ANSI_C_CODING_STANDARDS_H

#include ANSI C Standard Library Header File

#include Operating System Library Header File

#include “Your System Library Header File”

/*

* ####################

* # global constants #

* ####################

*/

/*

* #################

* # global macros #

* #################

*/

/*

* ##############################

* # global abstract data types #

* ##############################

*/

/*

* ####################

* # global variables #

* ####################

*/

/*

* #############

* # externals #

* #############

*/

/*

* ###############################

* # global functions prototypes #

* ###############################

*/

#endif ANSI_C_CODING_STANDARDS_H

/* in ANSI_C_CODING_STANDARDS.c */

/*

* Copyright 2005, XX, Inc., China

* All rights reserved.

*

* XX’s source code is an unpublished work and the use of a copyright notice does

* not imply otherwise. This source code contains confidential, trade secret material of

* XX, Inc. Any attempt or participation in deciphering, decoding, reverse engineering

* or in any way altering the source code is strictly prohibited, unless the prior written

* consent of XX, Inc. is obtained.

*/

/*

* @file ANSI_C_CODING_STANDARDS.c

* @author tony_bai

* @date 2005-07-01

* @brief the template for ANSI C

*        source file

*/

/*

* @revision

*   @version 0.1

*   @date 2005-08-01

*   @Revisor tony_bai

*

* @revision

*   @version 0.2

*   @date 2005-09-01

*   @Revisor tony_bai

*/

#include ANSI C Standard Library Header File

#include Operating System Library Header File

#include “Your System Library Header File”

/*

* ###################

* # local constants #

* ###################

*/

/*

* ################

* # local macros #

* ################

*/

/*

* #############################

* # local abstract data types #

* #############################

*/

/*

* ###################

* # local variables #

* ###################

*/

/*

* ##############################

* # local functions prototypes #

* ##############################

*/

/*

* ####################################

* # global functions implementations #

* ####################################

*/

/*

* ###################################

* # local functions implementations #

* ###################################

*/