Code analysis tool for visual studio is able to detect some kinds of errors statically if you annotate functions with SAL
We used it at first in windows driver when code was mostly C code, and where for example Out annotation used in conjunction with NTSTATUS as return would check if the client access of the Out variable was done only on the success path and also assure that the implementer was setting the out parameter when no error occurred.
Switching to c++ code it would be helpful to use some of the same tools support but things seem much more limiting in this context. For example if i have an Out Obj& - I didn't manage for SAL to detect misuses as in the case of an C Out pointer.
Also __checkReturn SAL seems to work only for primitive types. What is your experience using SAL on windows (including C++ driver) ?
Aucun commentaire:
Enregistrer un commentaire