2010-11-04 28 views
6

我今天讀了VS2010中的sal.h。
我有點驚訝。我們應該使用_In_而不是__in?

// This section contains the deprecated annotations 
|------------|------------|---------|--------|----------|----------|---------------| 
| Level | Usage | Size | Output | NullTerm | Optional | Parameters | 
|------------|------------|---------|--------|----------|----------|---------------| 
| <>   | <>   | <>  | <>  | _z  | <>  | <>   | 
| _deref  | _in  | _ecount | _full | _nz  | _opt  | (size)  | 
| _deref_opt | _out  | _bcount | _part |   |   | (size,length) | 
|   | _inout  |   |  |   |   |    | 
|   |   |   |  |   |   |    | 
|------------|------------|---------|--------|----------|----------|---------------| 

我總是使用這些註釋。
我不相信他們已被棄用。這是真的嗎?
如果是這樣,爲什麼?
從現在起我們應該使用下面的註釋嗎? - 它不熟悉,我:(

|--------------|----------|----------------|-----------------------------| 
| Usage  | Nullness | ZeroTerminated | Extent      | 
|--------------|----------|----------------|-----------------------------| 
| _In_   | <>  | <>    | <>       | 
| _Out_  | opt_  | z_    | [byte]cap_[c_|x_](size) | 
| _Inout_  |   |    | [byte]count_[c_|x_](size) | 
| _Deref_out_ |   |    | ptrdiff_cap_(ptr)   | 
|--------------|   |    | ptrdiff_count_(ptr)  | 
| _Ret_  |   |    |        | 
| _Deref_ret_ |   |    |        | 
|--------------|   |    |        | 
| _Pre_  |   |    |        | 
| _Post_  |   |    |        | 
| _Deref_pre_ |   |    |        | 
| _Deref_post_ |   |    |        | 
|--------------|----------|----------------|-----------------------------| 

順便說一句,SAL標籤不存在SO。
請吧,如果你能。

+0

嗯這看起來像SQL ...什麼語言你指到Windows,Visual Studio中,和?微軟不是語言,我猜MS SQL,bu t'.h'表示C或C++。 – mpen 2010-11-04 01:04:58

+2

SAL不是一種語言。這是c/C++的註釋。 – Benjamin 2010-11-04 01:07:42

+4

Mark:SAL是源代碼註釋語言(http://msdn.microsoft.com/en-us/library/ms235402(VS.100).aspx),它用於註釋C/C++函數中的參數,因此編譯器和其他工具可以提供更好的警告。 – Gabe 2010-11-04 01:08:30

回答

相關問題