lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master 16ae501 3/3: Spell global operator new '::new


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 16ae501 3/3: Spell global operator new '::new'
Date: Sat, 6 Feb 2021 14:47:06 -0500 (EST)

branch: master
commit 16ae501e88fffe80f2428088c9fa7ca136f970ad
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>

    Spell global operator new '::new'
    
    The spelling '::new' is greppable.
    
    This command:
    
    git grep '[^:]\<new\>' *.?pp |sed -e'/new(wx)/d' -e'/^[^:]*: *\/\//d' \
      |less -SN
    
    appears to find no call to operator new, except in product-editor code
    that is better left alone. Conversely, grepping for '::new' finds only
    candidates for more sophisticated treatment like make_{shared,unique}.
---
 accountvalue.cpp        | 6 +++---
 any_member.hpp          | 4 ++--
 cache_file_reads.hpp    | 2 +-
 comma_punct_test.cpp    | 2 +-
 gpt_input.cpp           | 2 +-
 gpt_test.cpp            | 2 +-
 group_values.cpp        | 2 +-
 ihs_acctval.cpp         | 6 +++---
 ihs_irc7702.cpp         | 8 ++++----
 input_harmonization.cpp | 2 +-
 ledger.cpp              | 4 ++--
 ledger_text_formats.cpp | 6 +++---
 main_wx_test.cpp        | 2 +-
 mec_input.cpp           | 2 +-
 rate_table.cpp          | 6 +++---
 rate_table_tool.cpp     | 4 ++--
 skeleton.cpp            | 8 ++++----
 vector_test.cpp         | 4 ++--
 xml_lmi.cpp             | 8 ++++----
 19 files changed, 40 insertions(+), 40 deletions(-)

diff --git a/accountvalue.cpp b/accountvalue.cpp
index e95e79c..308f50b 100644
--- a/accountvalue.cpp
+++ b/accountvalue.cpp
@@ -109,9 +109,9 @@ showing {accesses, modifies current year, modifies future 
years}
 AccountValue::AccountValue(Input const& input)
     :BasicValues       (Input::consummate(input))
     ,DebugFilename     {"anonymous.monthly_trace"}
-    ,ledger_{new Ledger(BasicValues::GetLength(), BasicValues::ledger_type(), 
BasicValues::nonillustrated(), BasicValues::no_can_issue(), false)}
-    ,ledger_invariant_ {new LedgerInvariant(BasicValues::GetLength())}
-    ,ledger_variant_   {new LedgerVariant  (BasicValues::GetLength())}
+    ,ledger_{::new Ledger(BasicValues::GetLength(), 
BasicValues::ledger_type(), BasicValues::nonillustrated(), 
BasicValues::no_can_issue(), false)}
+    ,ledger_invariant_ {::new LedgerInvariant(BasicValues::GetLength())}
+    ,ledger_variant_   {::new LedgerVariant  (BasicValues::GetLength())}
     ,RunBasis_         {mce_run_gen_curr_sep_full}
     ,GenBasis_         {mce_gen_curr}
     ,SepBasis_         {mce_sep_full}
diff --git a/any_member.hpp b/any_member.hpp
index 11ab6c2..1bd2a80 100644
--- a/any_member.hpp
+++ b/any_member.hpp
@@ -181,7 +181,7 @@ holder<ClassType,ValueType>& 
holder<ClassType,ValueType>::assign
 template<typename ClassType, typename ValueType>
 placeholder* holder<ClassType,ValueType>::clone() const
 {
-    return new holder(object_, held_);
+    return ::new holder(object_, held_);
 }
 
 template<typename ClassType, typename ValueType>
@@ -297,7 +297,7 @@ template<typename ClassType>
 template<typename ValueType>
 any_member<ClassType>::any_member(ClassType* object, ValueType const& value)
     :object_  {object}
-    ,content_ {new holder<ClassType,ValueType>(object, value)}
+    ,content_ {::new holder<ClassType,ValueType>(object, value)}
 {}
 
 template<typename ClassType>
diff --git a/cache_file_reads.hpp b/cache_file_reads.hpp
index 0229420..2251363 100644
--- a/cache_file_reads.hpp
+++ b/cache_file_reads.hpp
@@ -81,7 +81,7 @@ class file_cache
             )
             {
             // Construct before inserting because ctor might throw.
-            retrieved_type value(new T(filename));
+            retrieved_type value(::new T(filename));
 
             // insert() doesn't update the value if the key is already
             // present, so insert a dummy value and then modify it.
diff --git a/comma_punct_test.cpp b/comma_punct_test.cpp
index a4114f2..e53db36 100644
--- a/comma_punct_test.cpp
+++ b/comma_punct_test.cpp
@@ -36,7 +36,7 @@ int test_main(int, char*[])
     std::ostringstream oss;
 
     std::locale loc;
-    std::locale new_loc(loc, new comma_punct);
+    std::locale new_loc(loc, ::new comma_punct);
     oss.imbue(new_loc);
     oss.setf(std::ios_base::fixed, std::ios_base::floatfield);
 
diff --git a/gpt_input.cpp b/gpt_input.cpp
index e2ace0c..bcf4d19 100644
--- a/gpt_input.cpp
+++ b/gpt_input.cpp
@@ -263,7 +263,7 @@ void gpt_input::DoAdaptExternalities()
     CachedStateOfJurisdiction_   = StateOfJurisdiction  .value();
 
     database_.reset
-        (new product_database
+        (::new product_database
             (CachedProductName_
             ,CachedGender_
             ,CachedUnderwritingClass_
diff --git a/gpt_test.cpp b/gpt_test.cpp
index 39f2e2f..db0518a 100644
--- a/gpt_test.cpp
+++ b/gpt_test.cpp
@@ -435,7 +435,7 @@ Irc7702& gpt_test::instantiate_old(int issue_age)
     assign(adj_qab_adb_rate, qab_adb_rate * adj);
     delete ugliness;
     ugliness =
-        (new Irc7702
+        (::new Irc7702
             (mce_gpt                         // a_Test7702
             ,issue_age                       // a_IssueAge
             ,issue_age + length              // a_EndtAge
diff --git a/group_values.cpp b/group_values.cpp
index 78cbe74..d2d8a69 100644
--- a/group_values.cpp
+++ b/group_values.cpp
@@ -466,7 +466,7 @@ census_run_result run_census::operator()
     // If cell_should_be_ignored() is true for all cells, composite
     // length is appropriately zero.
     composite_.reset
-        (new Ledger
+        (::new Ledger
             (composite_length
             ,cells[0].ledger_type()
             ,false
diff --git a/ihs_acctval.cpp b/ihs_acctval.cpp
index dc82620..5815606 100644
--- a/ihs_acctval.cpp
+++ b/ihs_acctval.cpp
@@ -93,9 +93,9 @@ AccountValue::AccountValue(Input const& input)
     ,Solving               {mce_solve_none != 
BasicValues::yare_input_.SolveType}
     ,SolvingForGuarPremium {false}
     ,ItLapsed              {false}
-    ,ledger_{new Ledger(BasicValues::GetLength(), BasicValues::ledger_type(), 
BasicValues::nonillustrated(), BasicValues::no_can_issue(), false)}
-    ,ledger_invariant_     {new LedgerInvariant(BasicValues::GetLength())}
-    ,ledger_variant_       {new LedgerVariant  (BasicValues::GetLength())}
+    ,ledger_{::new Ledger(BasicValues::GetLength(), 
BasicValues::ledger_type(), BasicValues::nonillustrated(), 
BasicValues::no_can_issue(), false)}
+    ,ledger_invariant_     {::new LedgerInvariant(BasicValues::GetLength())}
+    ,ledger_variant_       {::new LedgerVariant  (BasicValues::GetLength())}
     ,SolveGenBasis_        {mce_gen_curr}
     ,SolveSepBasis_        {mce_sep_full}
     ,RunBasis_             {mce_run_gen_curr_sep_full}
diff --git a/ihs_irc7702.cpp b/ihs_irc7702.cpp
index c7355b3..d456f08 100644
--- a/ihs_irc7702.cpp
+++ b/ihs_irc7702.cpp
@@ -439,7 +439,7 @@ void Irc7702::InitCommFns()
 
     // Commutation functions using 4% min i: both options 1 and 2
     CommFns[Opt1Int4Pct].reset
-        (new ULCommFns
+        (::new ULCommFns
             (Qc
             ,GLPic
             ,glp_naar_disc_rate
@@ -450,7 +450,7 @@ void Irc7702::InitCommFns()
     DEndt[Opt1Int4Pct] = CommFns[Opt1Int4Pct]->aDomega();
 
     CommFns[Opt2Int4Pct].reset
-        (new ULCommFns
+        (::new ULCommFns
             (Qc
             ,GLPic
             ,glp_naar_disc_rate
@@ -462,7 +462,7 @@ void Irc7702::InitCommFns()
 
     // Commutation functions using 6% min i: always option 1
     CommFns[Opt1Int6Pct].reset
-        (new ULCommFns
+        (::new ULCommFns
             (Qc
             ,GSPic
             ,gsp_naar_disc_rate
@@ -1048,7 +1048,7 @@ int main()
 
     Timer timer;
 
-    Irc7702* Irc7702_ = new Irc7702
+    Irc7702* Irc7702_ = ::new Irc7702
         (CVAT
         ,45
         ,100000.0
diff --git a/input_harmonization.cpp b/input_harmonization.cpp
index b7c2f9b..db82472 100644
--- a/input_harmonization.cpp
+++ b/input_harmonization.cpp
@@ -82,7 +82,7 @@ void Input::DoAdaptExternalities()
     CachedStateOfJurisdiction_   = StateOfJurisdiction  .value();
 
     database_.reset
-        (new product_database
+        (::new product_database
             (CachedProductName_
             ,CachedGender_
             ,CachedUnderwritingClass_
diff --git a/ledger.cpp b/ledger.cpp
index 83ceadc..3fd1927 100644
--- a/ledger.cpp
+++ b/ledger.cpp
@@ -75,8 +75,8 @@ Ledger::Ledger
     ,nonillustrated_       {nonillustrated}
     ,no_can_issue_         {no_can_issue}
     ,is_composite_         {is_composite}
-    ,ledger_map_           {new ledger_map_holder}
-    ,ledger_invariant_     {new LedgerInvariant(length)}
+    ,ledger_map_           {::new ledger_map_holder}
+    ,ledger_invariant_     {::new LedgerInvariant(length)}
 {
     SetRunBases(length);
 
diff --git a/ledger_text_formats.cpp b/ledger_text_formats.cpp
index b856a04..17471d1 100644
--- a/ledger_text_formats.cpp
+++ b/ledger_text_formats.cpp
@@ -227,7 +227,7 @@ std::string calculation_summary_formatter::format_as_html() 
const
     std::ostringstream oss;
 
     std::locale loc;
-    std::locale new_loc(loc, new comma_punct);
+    std::locale new_loc(loc, ::new comma_punct);
     oss.imbue(new_loc);
     oss.setf(std::ios_base::fixed, std::ios_base::floatfield);
 
@@ -340,7 +340,7 @@ std::string calculation_summary_formatter::format_as_tsv() 
const
     std::ostringstream oss;
 
     std::locale loc;
-    std::locale new_loc(loc, new comma_punct);
+    std::locale new_loc(loc, ::new comma_punct);
     oss.imbue(new_loc);
     oss.setf(std::ios_base::fixed, std::ios_base::floatfield);
 
@@ -1177,7 +1177,7 @@ std::string ledger_format
         {
         std::stringstream ss {};
         std::locale loc;
-        std::locale new_loc(loc, new comma_punct);
+        std::locale new_loc(loc, ::new comma_punct);
         ss.imbue(new_loc);
         ss.setf(std::ios_base::fixed, std::ios_base::floatfield);
         return ss;
diff --git a/main_wx_test.cpp b/main_wx_test.cpp
index ab19c0a..6402501 100644
--- a/main_wx_test.cpp
+++ b/main_wx_test.cpp
@@ -702,7 +702,7 @@ DocManagerEx* SkeletonTest::CreateDocManager()
 
     // As in the base class version, notice that we must not use 'new(wx)' here
     // as this object is deleted by wxWidgets itself.
-    return new DocManagerTest;
+    return ::new DocManagerTest;
 }
 
 bool SkeletonTest::OnInit()
diff --git a/mec_input.cpp b/mec_input.cpp
index b666fd3..69b8f41 100644
--- a/mec_input.cpp
+++ b/mec_input.cpp
@@ -230,7 +230,7 @@ void mec_input::DoAdaptExternalities()
     CachedStateOfJurisdiction_   = StateOfJurisdiction  .value();
 
     database_.reset
-        (new product_database
+        (::new product_database
             (CachedProductName_
             ,CachedGender_
             ,CachedUnderwritingClass_
diff --git a/rate_table.cpp b/rate_table.cpp
index df5718a..82ab99a 100644
--- a/rate_table.cpp
+++ b/rate_table.cpp
@@ -2996,13 +2996,13 @@ bool database::exists(fs::path const& path)
 }
 
 database::database()
-    :impl_ {new database_impl(fs::path())}
+    :impl_ {::new database_impl(fs::path())}
 {
 }
 
 database::database(fs::path const& path)
 try
-    :impl_ {new database_impl(path)}
+    :impl_ {::new database_impl(path)}
 {
 }
 catch(std::runtime_error const& e)
@@ -3020,7 +3020,7 @@ database::database
     ,std::shared_ptr<std::istream> data_is
     )
 try
-    :impl_ {new database_impl(index_is, data_is)}
+    :impl_ {::new database_impl(index_is, data_is)}
 {
 }
 catch(std::runtime_error const& e)
diff --git a/rate_table_tool.cpp b/rate_table_tool.cpp
index 10a85e2..3601ff1 100644
--- a/rate_table_tool.cpp
+++ b/rate_table_tool.cpp
@@ -126,11 +126,11 @@ void merge
     std::unique_ptr<database> table_file;
     if(database::exists(database_filename))
         {
-        table_file.reset(new database(database_filename));
+        table_file.reset(::new database(database_filename));
         }
     else
         {
-        table_file.reset(new database);
+        table_file.reset(::new database);
         }
 
     int count = 0;
diff --git a/skeleton.cpp b/skeleton.cpp
index 22e96d3..9820d1d 100644
--- a/skeleton.cpp
+++ b/skeleton.cpp
@@ -279,12 +279,12 @@ wxMenuBar* Skeleton::AdjustMenus(wxMenuBar* argument)
 
 /// Create the MDI document manager.
 ///
-/// This uses 'new' rather than 'new(wx)' because the object is
+/// This uses '::new' rather than 'new(wx)' because the object is
 /// explicitly deleted in OnExit().
 
 DocManagerEx* Skeleton::CreateDocManager()
 {
-    return new DocManagerEx;
+    return ::new DocManagerEx;
 }
 
 void Skeleton::InitDocManager()
@@ -1081,10 +1081,10 @@ void 
Skeleton::UponTestFloatingPointEnvironment(wxCommandEvent&)
 
 void Skeleton::UponTestPasting(wxCommandEvent&)
 {
-    // This uses 'new' rather than 'new(wx)' because the object is
+    // This uses '::new' rather than 'new(wx)' because the object is
     // explicitly deleted by calling Destroy(); yet the Destroy()
     // call isn't reached if an exception is thrown.
-    InputSequenceEntry* z = new InputSequenceEntry(frame_, wxID_ANY, 
"Testing...");
+    InputSequenceEntry* z = ::new InputSequenceEntry(frame_, wxID_ANY, 
"Testing...");
     LMI_ASSERT(z);
     wxTextCtrl& t = z->text_ctrl();
 
diff --git a/vector_test.cpp b/vector_test.cpp
index 9c13917..749b141 100644
--- a/vector_test.cpp
+++ b/vector_test.cpp
@@ -172,7 +172,7 @@ class simple_array0
     simple_array0(int n, double d = 0.0)
         :length_ {n}
         {
-        data_ = new double[length_];
+        data_ = ::new double[length_];
         for(int j = 0; j < length_; ++j) data_[j] = d;
         }
 
@@ -198,7 +198,7 @@ class simple_array0
         {
         delete[] data_;
         length_ = new_size;
-        data_ = new double[length_];
+        data_ = ::new double[length_];
         for(int j = 0; j < length_; ++j) data_[j] = j;
         }
 
diff --git a/xml_lmi.cpp b/xml_lmi.cpp
index b71ddc1..c10c32d 100644
--- a/xml_lmi.cpp
+++ b/xml_lmi.cpp
@@ -62,7 +62,7 @@ xml_lmi::dom_parser::dom_parser(std::string const& filename)
             {
             throw std::runtime_error("File does not exist.");
             }
-        parser_.reset(new DomParser(filename.c_str()));
+        parser_.reset(::new DomParser(filename.c_str()));
         }
     catch(std::exception const& e)
         {
@@ -85,7 +85,7 @@ xml_lmi::dom_parser::dom_parser(char const* data, std::size_t 
length)
     try
         {
         error_context_ = "Unable to parse xml data: ";
-        parser_.reset(new DomParser(data, length));
+        parser_.reset(::new DomParser(data, length));
         }
     catch(std::exception const& e)
         {
@@ -120,7 +120,7 @@ xml_lmi::dom_parser::dom_parser(std::istream const& is)
             }
         std::string s;
         istream_to_string(is, s);
-        parser_.reset(new DomParser(s.c_str(), 1 + s.size()));
+        parser_.reset(::new DomParser(s.c_str(), 1 + s.size()));
         }
     catch(std::exception const& e)
         {
@@ -202,7 +202,7 @@ xml::element const& xml_lmi::dom_parser::root_node
 }
 
 xml_lmi::xml_document::xml_document(std::string const& root_node_name)
-    :document_ {new xml_lmi::Document(xml::element(root_node_name.c_str()))}
+    :document_ {::new xml_lmi::Document(xml::element(root_node_name.c_str()))}
 {
 }
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]