Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what is the difference between __deref_out_opt and __deref_opt_out?

What is the difference between the following SAL annotations?

void foo(__deref_out_opt PSTR* bar);

void foo(__deref_opt_out PSTR* bar);
like image 523
John Avatar asked Jan 24 '11 01:01

John


1 Answers

A PSTR* out parameter means the caller passes in a buffer which receives a pointer to a string.

In __deref_out_opt, the string is optional (the function puts NULL in the caller-provided buffer).

In __deref_opt_out, the buffer is optional (the caller passes NULL to indicate disinterest in the output value).

Presumably, it's possible to combine these concepts, there should be a __deref_opt_out_opt modifier for that.

like image 104
Ben Voigt Avatar answered Nov 18 '22 21:11

Ben Voigt