Date: prev next · Thread: first prev next last
2016 Archives by date, by thread · List index


On 12/03/2016 07:10 PM, Jochen Nitschke wrote:
commit 76936e787bd13fb1a747b7c716df3fba2d0d3fa9
Author: Jochen Nitschke <j.nitschke+logerrit@ok.de>
Date:   Sat Dec 3 13:39:44 2016 +0100

    cppcheck style fix for noExplicitConstructor in writerfilter

    make ctors with one parameter explicit

Seeing this and similar commits mentioning "cppcheck" and "noExplicitConstructor" made me curious:

* Is cppcheck reporting each and every ctor (with one parameter? callable with one argument?) that isn't declared as explicit? Or does it use some heuristic that might be actually useful?

* Why that concentration on single-parameter ctors? Is cppcheck a pre-C++11 tool? That leads to an arbitrary-looking mix of explicit and non-explicit ctors in cases like

[...]
diff --git a/writerfilter/source/rtftok/rtfvalue.hxx b/writerfilter/source/rtftok/rtfvalue.hxx
index eeb9730..d113fbf 100644
--- a/writerfilter/source/rtftok/rtfvalue.hxx
+++ b/writerfilter/source/rtftok/rtfvalue.hxx
@@ -32,14 +32,14 @@ public:
              css::uno::Reference<css::embed::XEmbeddedObject> const& xObject,
              bool bForceString, const RTFShape& aShape);
     RTFValue();
-    RTFValue(int nValue);
+    explicit RTFValue(int nValue);
     RTFValue(const OUString& sValue, bool bForce = false);
-    RTFValue(RTFSprms rAttributes);
+    explicit RTFValue(RTFSprms rAttributes);
     RTFValue(RTFSprms rAttributes, RTFSprms rSprms);
-    RTFValue(css::uno::Reference<css::drawing::XShape> const& xShape);
-    RTFValue(css::uno::Reference<css::io::XInputStream> const& xStream);
-    RTFValue(css::uno::Reference<css::embed::XEmbeddedObject> const& xObject);
-    RTFValue(const RTFShape& aShape);
+    explicit RTFValue(css::uno::Reference<css::drawing::XShape> const& xShape);
+    explicit RTFValue(css::uno::Reference<css::io::XInputStream> const& xStream);
+    explicit RTFValue(css::uno::Reference<css::embed::XEmbeddedObject> const& xObject);
+    explicit RTFValue(const RTFShape& aShape);
     virtual ~RTFValue() override;
     void setString(const OUString& sValue);
     virtual int getInt() const override;

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.