Our website uses cookies to enhance your browsing experience.
Accept
to the top
close form

Fill out the form in 2 simple steps below:

Your contact information:

Step 1
Congratulations! This is your promo code!

Desired license type:

Step 2
Team license
Enterprise license
** By clicking this button you agree to our Privacy Policy statement
close form
Request our prices
New License
License Renewal
--Select currency--
USD
EUR
* By clicking this button you agree to our Privacy Policy statement

close form
Free PVS‑Studio license for Microsoft MVP specialists
* By clicking this button you agree to our Privacy Policy statement

close form
To get the licence for your open-source project, please fill out this form
* By clicking this button you agree to our Privacy Policy statement

close form
I am interested to try it on the platforms:
* By clicking this button you agree to our Privacy Policy statement

close form
check circle
Message submitted.

Your message has been sent. We will email you at


If you do not see the email in your inbox, please check if it is filtered to one of the following folders:

  • Promotion
  • Updates
  • Spam

>
>
>
Examples of errors detected by the V106…

Examples of errors detected by the V1061 diagnostic

V1061. Extending 'std' or 'posix' namespace may result in undefined behavior.


DeepSpeech

V1061 Extending the 'std' namespace may result in undefined behavior. sized_iterator.hh 210


// Dirty hack because g++ 4.6 at least wants
// to do a bunch of copy operations.
namespace std {
inline void iter_swap(util::SizedIterator first,
                      util::SizedIterator second)
{
  util::swap(*first, *second);
}
} // namespace std

RPCS3

V1061 Extending the 'std' namespace may result in undefined behavior. shared_ptr.hpp 1131


namespace std
{
  template <typename T>
  void swap(stx::single_ptr<T>& lhs, stx::single_ptr<T>& rhs) noexcept
  {
    lhs.swap(rhs);
  }

  template <typename T>
  void swap(stx::shared_ptr<T>& lhs, stx::shared_ptr<T>& rhs) noexcept
  {
    lhs.swap(rhs);
  }
}

CARLA

V1061 Extending the 'std' namespace may result in undefined behavior. Waypoint.cpp 11


// Waypoint.h
namespace std {

  template <>
  struct hash<carla::road::element::Waypoint> {

    using argument_type = carla::road::element::Waypoint;

    using result_type = uint64_t;

    result_type operator()(const argument_type& waypoint) const;

  };

} // namespace std

// Waypoint.cpp
namespace std {

  using WaypointHash = hash<carla::road::element::Waypoint>;  // <=

  WaypointHash::result_type WaypointHash::operator()(
    const argument_type &waypoint) const
  {
    WaypointHash::result_type seed = 0u;
    boost::hash_combine(seed, waypoint.road_id);
    boost::hash_combine(seed, waypoint.section_id);
    boost::hash_combine(seed, waypoint.lane_id);
    boost::hash_combine(seed,
                        static_cast<float>(std::floor(waypoint.s * 200.0)));
    return seed;
  }

} // namespace std

YTsaurus

V1061 Extending the 'std' namespace may result in undefined behavior. int128.h:378:1


template <bool IsSigned>
class TInteger128 { .... };

using ui128 = TInteger128<false>;
using i128 = TInteger128<true>;


// specialize std templates
namespace std
{
  ....

  constexpr bool signbit(const ui128 arg) noexcept
  {
    Y_UNUSED(arg);
    return false;
  }
  constexpr bool signbit(const i128 arg) noexcept
  {
    return GetHigh(arg) & 0x8000000000000000;
  }

  constexpr ui128 abs(const ui128 arg) noexcept
  {
    return arg;
  }
  constexpr i128 abs(const i128 arg) noexcept
  {
    return signbit(arg) ? (-arg) : arg;
  }
}

YTsaurus

V1061 Extending the 'std' namespace may result in undefined behavior. compact_vector-inl.h:999:1


namespace std
{
/////////////////////////////////////////////////////////////////////
template <class T, size_t N>
void swap(NYT::TCompactVector<T, N>& lhs,
          NYT::TCompactVector<T, N>& rhs)
{
  lhs.swap(rhs);
}

/////////////////////////////////////////////////////////////////////

template <class T, size_t N>
struct hash<NYT::TCompactVector<T, N>>
{
  size_t operator()(const NYT::TCompactVector<T, N>& container) const
  {
    size_t result = 0;
    for (const auto& element : container)
    {
      NYT::HashCombine(result, element);
    }

    return result;
  }
};
/////////////////////////////////////////////////////////////////////
}