是的,你看到的沒有任何中文字。筆者不推薦寫注釋使用中文,一是不國際化,二是目前還存在不支持中文的編譯器,三是不利于代碼的移植(平臺對中文的支持程度不同,會造成顯示亂碼等)。所以程序員還是老老實實的用英文寫注釋吧,而且還能增強自己的英文水平。一舉多得,何樂而不為。
下面是我給大家舉的幾個注釋的例子:
1.文件頭注釋
/* *****************************************************************
* @File Name : Main.c
* @Copyright (C/C++)
* @Author : Bernie Liu
* @DATE : 2014-02-21
* @Brief : marquee(horse race lamp)
* @Details : User can set the rate and the direction;Key1 set
the rate,Key2 set the direction
* @Version : V0.01
* @Target : C8051F005
* @ToolChain : Keil4
* @Notes :
*****************************************************************
*/
這個注釋是比較簡單的,在 @Details一欄并沒有詳細的講述此文件所做的工作,程序員在注釋文件頭的時候可以比較詳細的敘述此文件所能完成的功能
2.函數注釋
/*
****************************************************************
* @Function Name : UserSetMarqueeRates
* @Brief : User set the Marquee's rates
* @Details : rates include 8 modes, 0~8
* @Param[in] : 1)BYTE rates,User set from Key1 tunner