diff options
author | Taylor C. Richberger <taywee@gmx.com> | 2017-11-12 04:44:48 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-12 04:44:48 -0700 |
commit | 3331ae47078aef7f7c57e72ee5e06128301d61d2 (patch) | |
tree | b27e9877ca80026354ade982618f59af83ebb3f7 /args.hxx | |
parent | Merge pull request #40 from pavel-belikov/subparsers-validation (diff) | |
parent | fix uninitialized RaiiSubparser::oldSubparser (diff) | |
download | args.hxx-3331ae47078aef7f7c57e72ee5e06128301d61d2.tar.xz |
Merge pull request #41 from pavel-belikov/fix-uninitialized-values
Fix uninitialized values
Diffstat (limited to 'args.hxx')
-rw-r--r-- | args.hxx | 22 |
1 files changed, 11 insertions, 11 deletions
@@ -532,18 +532,18 @@ namespace args class Base { private: - Options options; + Options options = {}; protected: - bool matched; + bool matched = false; const std::string help; #ifdef ARGS_NOEXCEPT /// Only for ARGS_NOEXCEPT - mutable Error error; + mutable Error error = Error::None; #endif public: - Base(const std::string &help_, Options options_ = {}) : options(options_), matched(false), help(help_) {} + Base(const std::string &help_, Options options_ = {}) : options(options_), help(help_) {} virtual ~Base() {} Options GetOptions() const noexcept @@ -655,10 +655,10 @@ namespace args { protected: const std::string name; - bool kickout; + bool kickout = false; public: - NamedBase(const std::string &name_, const std::string &help_, Options options_ = {}) : Base(help_, options_), name(name_), kickout(false) {} + NamedBase(const std::string &name_, const std::string &help_, Options options_ = {}) : Base(help_, options_), name(name_) {} virtual ~NamedBase() {} virtual std::vector<std::tuple<std::string, std::string, unsigned>> GetDescription(const HelpParams &, const unsigned indentLevel) const override @@ -1723,10 +1723,10 @@ namespace args std::string terminator; - bool allowJoinedShortValue; - bool allowJoinedLongValue; - bool allowSeparateShortValue; - bool allowSeparateLongValue; + bool allowJoinedShortValue = true; + bool allowJoinedLongValue = true; + bool allowSeparateShortValue = true; + bool allowSeparateLongValue = true; protected: enum class OptionType @@ -2317,7 +2317,7 @@ namespace args command.subparser = &parser; } - Command::RaiiSubparser::RaiiSubparser(const Command &command_, const HelpParams ¶ms_): command(command_), parser(command, params_) + Command::RaiiSubparser::RaiiSubparser(const Command &command_, const HelpParams ¶ms_): command(command_), parser(command, params_), oldSubparser(command.subparser) { command.subparser = &parser; } |