STYLE: Use default member initialization
Converts a default constructor’s member initializers into the new
default member initializers in C++11. Other member initializers that match the
default member initializer are removed. This can reduce repeated code or allow
use of ‘= default’.
SRCDIR=/Users/johnsonhj/src/jsoncpp/ #My local SRC
BLDDIR=/Users/johnsonhj/src/jsoncpp/cmake-build-debug/ #My local BLD
cd /Users/johnsonhj/src/jsoncpp/cmake-build-debug/
run-clang-tidy.py -extra-arg=-D__clang__ -checks=-*,modernize-use-default-member-init -header-filter=.* -fix
diff --git a/include/json/writer.h b/include/json/writer.h
index 34e71ed..1653260 100644
--- a/include/json/writer.h
+++ b/include/json/writer.h
@@ -189,9 +189,9 @@
void writeValue(const Value& value);
JSONCPP_STRING document_;
- bool yamlCompatibilityEnabled_;
- bool dropNullPlaceholders_;
- bool omitEndingLineFeed_;
+ bool yamlCompatibilityEnabled_{false};
+ bool dropNullPlaceholders_{false};
+ bool omitEndingLineFeed_{false};
};
#if defined(_MSC_VER)
#pragma warning(pop)
@@ -257,9 +257,9 @@
ChildValues childValues_;
JSONCPP_STRING document_;
JSONCPP_STRING indentString_;
- unsigned int rightMargin_;
- unsigned int indentSize_;
- bool addChildValues_;
+ unsigned int rightMargin_{74};
+ unsigned int indentSize_{3};
+ bool addChildValues_{false};
};
#if defined(_MSC_VER)
#pragma warning(pop)
@@ -331,7 +331,7 @@
ChildValues childValues_;
JSONCPP_OSTREAM* document_;
JSONCPP_STRING indentString_;
- unsigned int rightMargin_;
+ unsigned int rightMargin_{74};
JSONCPP_STRING indentation_;
bool addChildValues_ : 1;
bool indented_ : 1;