mirror of
https://github.com/cookiengineer/audacity
synced 2025-10-24 23:33:50 +02:00
More changes to Audacity.h to hide new and delete from code sweeps...
... changed some comments, and hid = delete in a macro. That is a new C++11 feature that lets you stipulate that a class suppresses an otherwise inherited or generated name.
This commit is contained in:
@@ -164,9 +164,12 @@ void QuitAudacity();
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
// Reviewed, certified, non-leaky uses of new that immediately entrust their results to RAII objects.
|
||||
// You may use it in new code when constructing a wxWindow subclass with non-NULL parent window.
|
||||
// You may use it in new code when the new expression is the constructor argument for a standard smart
|
||||
// This renames a good use of this C++ keyword that we don't need to review when hunting for leaks.
|
||||
#define PROHIBITED = delete
|
||||
|
||||
// Reviewed, certified, non-leaky uses of NEW that immediately entrust their results to RAII objects.
|
||||
// You may use it in NEW code when constructing a wxWindow subclass with non-NULL parent window.
|
||||
// You may use it in NEW code when the NEW expression is the constructor argument for a standard smart
|
||||
// pointer like std::unique_ptr or std::shared_ptr.
|
||||
#define safenew new
|
||||
|
||||
@@ -181,8 +184,8 @@ void QuitAudacity();
|
||||
auto q = std::make_unique<Myclass[]>(count);
|
||||
q[0].DoSomethingElse();
|
||||
|
||||
The first hides naked new and delete from the source code.
|
||||
The second hides new[] and delete[]. Both of course ensure destruction if
|
||||
The first hides naked NEW and DELETE from the source code.
|
||||
The second hides NEW[] and DELETE[]. Both of course ensure destruction if
|
||||
you don't use something like std::move(p) or q.release(). Both expressions require
|
||||
that you identify the type only once, which is brief and less error prone.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user