I have been reading about SAL and I'm not clear on if annotations on pointer types apply to the reference or the value it points to. For example, if I have:
void f(_In_ type* t);
_In_
means "The parameter must be valid in pre-state and will not be modified." Does its application here mean that the address of t will not change, or the value of t?
In your example,
_In_
means thatt
is checked for null before dereferencing it in the function;t
is assumed to be non-null in the function itself. By changing_In_
to_In_opt_
, VS Code Analysis will validate thatt
is checked for null before dereferencing it.type
from the memory pointed at byt
, like assigning the value of the dereferenced pointer to a variable.