SAL annotations - how they work?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How the code annotations ( __in_opt, __out, __checkReturn ... ) are supposed
to work ?
Are they part of the new MS C language (that's, real tokens understood by
the compiler), or always #define'd as nothing and interpreted by some
external tools?

Regards,
--PA
 
Hi Pavel!
How the code annotations ( __in_opt, __out, __checkReturn ... ) are supposed
to work ?
Are they part of the new MS C language (that's, real tokens understood by
the compiler), or always #define'd as nothing and interpreted by some
external tools?

In VC8 it is understood by the compiler and it can be checked if you
specify the /analyze switch.

See: /analyze
http://msdn2.microsoft.com/library/ms173498(en-us,vs.80).aspx

For more info see:

See: Header Annotations
http://msdn.microsoft.com/library/en-us/winprog/winprog/header_annotations.asp

See: Code Analysis for C/C++ Overview
http://msdn2.microsoft.com/library/d3bbz7tz(en-us,vs.80).aspx

See: Using Annotations to Reduce C/C++ Code Defects
http://msdn2.microsoft.com/library/ms182032(en-us,vs.80).aspx


Of course... the documentation is currently not very good...

In the DDK this method is used at least for more than 1-2 years (called
FxCop).

--
Greetings
Jochen

My blog about Win32 and .NET
http://blog.kalmbachnet.de/
 
Jochen said:
In the DDK this method is used at least for more than 1-2 years
(called FxCop).

Make that Prefast - FxCop is the CLR static analysis tool.

-cd
 
I've checked the current DDK (3790.1830) and found only
one copy of specstrings.h in inc\crt.
All these symbols defined there as nothing, so it isn't clear
how this is supposed to work.

As I understand, existing macros IN, OUT OPTIONAL are totally deprecated
because new compiler has more explicit conditions.
IN and OUT could be redefined as __in, __out, but OPTIONAL has no direct
match.

--PA
 
Back
Top