タイトルで尋ねられたように:
SAL (Source Annotation Language) の目的と、SAL 1 と SAL 2 の違いは何ですか?
使用法の基本を理解しています。これは、関数に渡される各変数の目的と、静的コード分析のための他のさまざまなことを強調するのに役立ちますが、実際にどれだけの違いが生じるか (パラメーター要件の明確化を無視して)プロジェクトの他のプログラマー)?
If I was to have the following prototype:
_Success_(return == 1)
int TestFunction( _In_ int* pTest, _Inopt_ char* pOptional );
This is supposed to "tell" the static analyser that the function will return 1 upon it's successful operation, that pTest
is a pointer which must not be nullptr
and that pOptional
is a pointer which may or may not be nullptr
. However, can't the static analyser get this information from the function definition itself? Moreover, what does it do with the information it gets such as the success criteria?
Furthermore, why is there a difference between SAL 1 and SAL 2, why did microsoft decide to change the way they named their macros (i.e. from __out
to _Out_
and __success
to _Success_
?)
I'm sorry if this is described somewhere in detail on the MSDN but I was unable to find it or any other question on StackOverflow with a detailed answer so I thought I'd ask in the hopes of having my curiosity satisfied.
Thanks in advance for your time!