Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer


The NullTerminated property specifies that either the last usable element of an array or buffer pointed to by a pointer contains the value zero. This property can be used with Pre and Post attributes. It is allowed on T* and T [], where T is of integral or pointer type.

The NullTerminated property must be set using one of the following values:

  • SA_Yes - the array is null terminated.

  • SA_No - the array is not null terminated.

  • SA_Maybe - the array may be null terminated.


In C++, the SA_ prefix is optional.

The following code shows how to use the NullTerminated property:

// C 
#include <CodeAnalysis\SourceAnnotations.h>
void f([SA_Pre(NullTerminated=SA_Yes)] char* pc);

// C++
#include <CodeAnalysis\SourceAnnotations.h>
using namespace vc_attributes;
void f([Pre(NullTerminated=Yes)] char* pc);

NullTerminated property cannot be applied to a function pointer.

© 2015 Microsoft