C++: Respond to review comments.

This commit is contained in:
Mathias Vorreiter Pedersen
2021-04-29 14:01:04 +02:00
parent e81b40978e
commit c67ab8f1f0
2 changed files with 5 additions and 5 deletions

View File

@@ -3,10 +3,11 @@
"qhelp.dtd">
<qhelp>
<overview>
<p>Different overloads of the <code>new</code> operator handle allocation failures in different ways:
<p>Different overloads of the <code>new</code> operator handle allocation failures in different ways.
If <code>new T</code> fails for some type <code>T</code>, it throws a <code>std::bad_alloc</code> exception,
but <code>new(std::nothrow) T</code> returns a null pointer. If the programmer handles the wrong kind of
failure, it could cause the program to behave in unexpected ways.</p>
but <code>new(std::nothrow) T</code> returns a null pointer. If the programmer does not use the corresponding
method of error handling, allocation failure may go unhandled and could cause the program to behave in
unexpected ways.</p>
</overview>
<recommendation>

View File

@@ -1,7 +1,6 @@
/**
* @name Detect And Handle Memory Allocation Errors
* @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 `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.
* @kind problem
* @id cpp/detect-and-handle-memory-allocation-errors
* @problem.severity warning