none
Data Types Info RRS feed

  • Question

  • I am new to the Windows Platform, so i tried finding out the solution of using "_IN_" or "_OUT_" with data types.

    Ques : What is the benefits of the usage of above two's ? I have gone through the SAL also.

    Please help me in this to understand the Windows platform very well.

    Thanks

    Thursday, December 24, 2015 1:52 PM

Answers

  • I believe you are referring to _In_ and _Out_ which are SAL.   These indicate an input and output parameter respectively.  So code analysis (a.k.a. Prefast) will know that the input parameter should be initialized before the call, and a pointer cannot be NULL since it was not specified as _In_opt_, and output parameter is not initialized going into the call, but will have values on completion of the call.

    Code analysis is an excellent way of finding errors, and adding the annotations like above makes it possible for the tool to find a large number of problems before you start debugging.  It can find subtle bugs, a classic was a generic piece of code that was designed to be used by both Linux and Windows drivers, the Linux team had developed it, and swore since it was in use for a year to be "bug free" when I first ran code analysis on the windows version of the driver, the shared module had over 40 bugs, all of which caused the Linux system to crash if the right conditions occurred.


    Don Burn Windows Driver Consulting Website: http://www.windrvr.com

    Thursday, December 24, 2015 2:11 PM

All replies

  • I believe you are referring to _In_ and _Out_ which are SAL.   These indicate an input and output parameter respectively.  So code analysis (a.k.a. Prefast) will know that the input parameter should be initialized before the call, and a pointer cannot be NULL since it was not specified as _In_opt_, and output parameter is not initialized going into the call, but will have values on completion of the call.

    Code analysis is an excellent way of finding errors, and adding the annotations like above makes it possible for the tool to find a large number of problems before you start debugging.  It can find subtle bugs, a classic was a generic piece of code that was designed to be used by both Linux and Windows drivers, the Linux team had developed it, and swore since it was in use for a year to be "bug free" when I first ran code analysis on the windows version of the driver, the shared module had over 40 bugs, all of which caused the Linux system to crash if the right conditions occurred.


    Don Burn Windows Driver Consulting Website: http://www.windrvr.com

    Thursday, December 24, 2015 2:11 PM
  • Thanks Brian for the support. Ur info helped me.
    Monday, December 28, 2015 4:36 AM