Skip to content

Commit 16bf30d

Browse files
authored
Add C++CoreGuidelines link to C26407
C26407 supports R.5, so I've added a link that points to it in the C++CoreGuidelines.
1 parent c6184f0 commit 16bf30d

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

docs/code-quality/c26407.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ ms.assetid: 5539907a-bfa0-40db-82a6-b860c97209e1
88
---
99
# C26407 DONT_HEAP_ALLOCATE_UNNECESSARILY
1010

11-
To avoid unnecessary use of pointers we try to detect common patterns of local allocations, for example when the result of a call to operator new is stored in a local variable and later explicitly deleted. This supports the rule R.5: *Prefer scoped objects, don't heap-allocate unnecessarily*. The suggested fix is to use an RAII type instead of a raw pointer and allow it to deal with resources. If an allocation is a single object, then it may be obviously unnecessary and a local variable of the object’s type would work better.
11+
To avoid unnecessary use of pointers we try to detect common patterns of local allocations, for example when the result of a call to operator new is stored in a local variable and later explicitly deleted. This supports the [C++ Core Guidelines rule R.5](https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#r5-prefer-scoped-objects-dont-heap-allocate-unnecessarily): *Prefer scoped objects, don't heap-allocate unnecessarily*. The suggested fix is to use an RAII type instead of a raw pointer and allow it to deal with resources. If an allocation is a single object, then it may be obviously unnecessary and a local variable of the object’s type would work better.
1212

1313
## Remarks
1414

0 commit comments

Comments
 (0)