Skip to content

Commit 27e662b

Browse files
authored
ES.61 clarify wording (isocpp#2137)
The original text was "If the `new` and the `delete` are in the same scope, mistakes can be flagged." This has been [misinterpreted](https://stackoverflow.com/q/75905524) to mean "Any `new` and `delete` in the same scope is a mistake and should be flagged." Reword the Enforcement clauses to follow the pattern established by the other Enforcement clauses: "Flag (bad thing)". Also, call the issue a "mismatch" rather than a "mistake", so that it is more clear that the underlying issue is the mismatch between scalar and array new/deletion.
1 parent 5eb1467 commit 27e662b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

CppCoreGuidelines.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -12474,7 +12474,7 @@ Flag naked `new`s and naked `delete`s.
1247412474

1247512475
##### Reason
1247612476

12477-
That's what the language requires and mistakes can lead to resource release errors and/or memory corruption.
12477+
That's what the language requires, and mismatches can lead to resource release errors and/or memory corruption.
1247812478

1247912479
##### Example, bad
1248012480

@@ -12491,8 +12491,8 @@ This example not only violates the [no naked `new` rule](#Res-new) as in the pre
1249112491

1249212492
##### Enforcement
1249312493

12494-
* If the `new` and the `delete` are in the same scope, mistakes can be flagged.
12495-
* If the `new` and the `delete` are in a constructor/destructor pair, mistakes can be flagged.
12494+
* Flag mismatched `new` and `delete` if they are in the same scope.
12495+
* Flag mismatched `new` and `delete` if they are in a constructor/destructor pair.
1249612496

1249712497
### <a name="Res-arr2"></a>ES.62: Don't compare pointers into different arrays
1249812498

0 commit comments

Comments
 (0)