Skip to content

Commit eae2364

Browse files
authored
Merge pull request #1594 from corob-msft/cr-sdl-672479
/SDL option: Fix DD672479 with info on pointer initialization.
2 parents 7aa2f31 + c7e4f9d commit eae2364

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

docs/build/reference/sdl-enable-additional-security-checks.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: "/sdl (Enable Additional Security Checks)"
3-
ms.date: "11/04/2016"
3+
ms.date: "11/26/2018"
44
f1_keywords: ["VC.Project.VCCLCompilerTool.SDLCheck"]
55
ms.assetid: 3dcf86a0-3169-4240-9f29-e04a9f535826
66
---
@@ -42,7 +42,17 @@ When **/sdl** is enabled, the compiler generates code to perform these checks at
4242

4343
- Performs limited pointer sanitization. In expressions that do not involve dereferences and in types that have no user-defined destructor, pointer references are set to a non-valid address after a call to `delete`. This helps to prevent the reuse of stale pointer references.
4444

45-
- Performs class member initialization. Automatically initializes all class members to zero on object instantiation (before the constructor runs). This helps prevent the use of uninitialized data associated with class members that the constructor does not explicitly initialize.
45+
- Performs class member pointer initialization. Automatically initializes class members of pointer type to **nullptr** on object instantiation (before the constructor runs). This helps prevent the use of uninitialized pointers that the constructor does not explicitly initialize. The compiler-generated member pointer initialization is called as long as:
46+
47+
- The object is not allocated using a custom (user defined) `operator new`
48+
49+
- The object is not allocated as part of an array (for example `new A[x]`)
50+
51+
- The class is not managed or imported
52+
53+
- The class has a user-defined default constructor.
54+
55+
To be initialized by the compiler-generated class initialization function, a member must be a pointer, and not a property or constant.
4656

4757
## Remarks
4858

0 commit comments

Comments
 (0)