Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should we use _In_ instead of __in?

I read sal.h, which is in VS2010, today.
I was a little surprised.

// 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     |         |        |          |          |               |
|            |            |         |        |          |          |               |
|------------|------------|---------|--------|----------|----------|---------------|

I always used these annotations.
I can't believe that they are deprecated. Is it true?
If so, why?
Should we use following annotations from now on? -It's not familiar to me :(

|--------------|----------|----------------|-----------------------------|
|   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_ |          |                |                             |
|--------------|----------|----------------|-----------------------------|

By the way, SAL tag doesn't exist in SO.
Please make it, if you could.

like image 664
Benjamin Avatar asked Nov 04 '10 01:11

Benjamin


People also ask

What does _IN_ mean?

The _In_ annotation indicates that: The parameter must be valid and will not be modified. The function will only read from the single-element buffer. The caller must provide the buffer and initialize it.

What is the function of SAL?

SAL provides a set of annotations to describe how a function uses its parameters and return type. For example, it indicates the assumptions it makes about them and the guarantees it makes on finishing. The header file <sal. h> defines the annotations.


1 Answers

It seems that you should getting used to the new "attribute" SAL format, see the comment in red in the middle of this post:

Link

like image 106
Alberto Martinez Avatar answered Sep 29 '22 11:09

Alberto Martinez