Export (0) Print
Expand All
1 out of 1 rated this helpful - Rate this topic


The Style property specifies a function that has a format string to be used with the SA_FormatString attribute. During analysis, the types of the variable argument list are compared to the format specifiers, for example, %d and %s, in the format string.

The valid values for Style are printf (for printf and wprintf functions) and scanf (for printf and wprintf).

The Style property can be used on parameters of the following types:

  • char *

  • wchar_t *

  • const char *

  • const wchar_t *

The following code shows how to use the Style property:

// C
#include <CodeAnalysis\SourceAnnotations.h>
void f( [SA_FormatString(Style="printf")] char *px, ...); 
void f( [SA_FormatString(Style="scanf")] char *px, ...); 

// C++
#include <CodeAnalysis\SourceAnnotations.h>
using namespace vc_attributes;
void f( [FormatString(Style="printf")] char *px, ...); 
void f( [FormatString(Style="scanf")] char *px, ...); 
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2014 Microsoft. All rights reserved.