Tuesday, May 24, 2011

_opt Mnemonic

​I always have trouble remembering where the opt goes in SAL in the __deref_out case. The mnemonic is pretty simple: the _opt at the start of the SAL is for the pointer value at the start of the function. And the _opt at the end of the SAL is for the dereferenced pointer value at the end of the function.






SALfoo == nullptr allowed at function start?*foo == nullptr allowed at function end?
__deref_out void **fooNoNo
__deref_opt_out void **fooYesNo
__deref_out_opt void **fooNoYes
__deref_opt_out_opt void **fooYesYes
.

No comments: