C++: Fix documentation.

This commit is contained in:
Mathias Vorreiter Pedersen
2021-05-25 10:16:22 +02:00
parent 3662ec4c83
commit eb244c0eb2
2 changed files with 3 additions and 3 deletions

View File

@@ -21,7 +21,7 @@ void bad2(std::size_t length) noexcept {
}
}
// GOOD: the allocation failure is handled appropiately.
// GOOD: the allocation failure is handled appropriately.
void good1(std::size_t length) noexcept {
try {
int* dest = new int[length];
@@ -32,7 +32,7 @@ void good1(std::size_t length) noexcept {
}
}
// GOOD: the allocation failure is handled appropiately.
// GOOD: the allocation failure is handled appropriately.
void good2(std::size_t length) noexcept {
int* dest = new int[length];
if(!dest) {

View File

@@ -1,6 +1,6 @@
/**
* @name Incorrect allocation-error handling
* @description `operator new` throws an exception on allocation failures, while `operator new(std::nothrow)` returns a null pointer. Mixing up these two failure conditions can result in unexpected behavior.
* @description Mixing up the failure conditions of 'operator new' and 'operator new(std::nothrow)' can result in unexpected behavior.
* @kind problem
* @id cpp/incorrect-allocation-error-handling
* @problem.severity warning