Opened 8 years ago

#11003 new Patches

Pointless use of using namespace std

Reported by: fsmv@… Owned by: chris_kohlhoff
Milestone: To Be Determined Component: asio
Version: Boost 1.57.0 Severity: Cosmetic
Keywords: Cc:

Description

There's a few lines in boost/asio/detail/impl/signal_set_service.ipp that use "using namespace std" inside a block for a single call to std::memset rather than just using "std::memset." These blocks of code are also clearly copied from each other but that might not be an issue.

Here's a patch switching those lines around:

--- boost/asio/detail/impl/signal_set_service.ipp  Mon Feb  9 10:42:58 2015
+++ boost/asio/detail/impl/signal_set_service.ipp  Mon Feb  9 10:44:35 2015
@@ -271,9 +271,8 @@
     if (state->registration_count_[signal_number] == 0)
     {
 # if defined(BOOST_ASIO_HAS_SIGACTION)
-      using namespace std; // For memset.
       struct sigaction sa;
-      memset(&sa, 0, sizeof(sa));
+      std::memset(&sa, 0, sizeof(sa));
       sa.sa_handler = boost_asio_signal_handler;
       sigfillset(&sa.sa_mask);
       if (::sigaction(signal_number, &sa, 0) == -1)
@@ -342,9 +341,8 @@
     if (state->registration_count_[signal_number] == 1)
     {
 # if defined(BOOST_ASIO_HAS_SIGACTION)
-      using namespace std; // For memset.
       struct sigaction sa;
-      memset(&sa, 0, sizeof(sa));
+      std::memset(&sa, 0, sizeof(sa));
       sa.sa_handler = SIG_DFL;
       if (::sigaction(signal_number, &sa, 0) == -1)
 # else // defined(BOOST_ASIO_HAS_SIGACTION)
@@ -396,9 +394,8 @@
     if (state->registration_count_[reg->signal_number_] == 1)
     {
 # if defined(BOOST_ASIO_HAS_SIGACTION)
-      using namespace std; // For memset.
       struct sigaction sa;
-      memset(&sa, 0, sizeof(sa));
+      std::memset(&sa, 0, sizeof(sa));
       sa.sa_handler = SIG_DFL;
       if (::sigaction(reg->signal_number_, &sa, 0) == -1)
 # else // defined(BOOST_ASIO_HAS_SIGACTION)

Change History (0)

Note: See TracTickets for help on using tickets.