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.
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.
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With