Cleanup: Initialize field members through ctor initializer list.
This seems to be a win as it avoids re-initialing the fields that have
a default constructor (non-POD), besides being the best and idiomatic
practice.
More details in http://stackoverflow.com/a/9903927
--
Change-Id: I6c184e8a53b385756938084ec60aebc8184243a0
Reviewed-on: https://bazel-review.googlesource.com/#/c/1513/3
MOS_MIGRATED_REVID=95815524
diff --git a/src/main/cpp/option_processor.cc b/src/main/cpp/option_processor.cc
index cdb1745..18a00e7 100644
--- a/src/main/cpp/option_processor.cc
+++ b/src/main/cpp/option_processor.cc
@@ -36,14 +36,12 @@
namespace blaze {
-OptionProcessor::RcOption::RcOption(int rcfile_index, const string& option) {
- rcfile_index_ = rcfile_index;
- option_ = option;
+OptionProcessor::RcOption::RcOption(int rcfile_index, const string& option)
+ : rcfile_index_(rcfile_index), option_(option) {
}
-OptionProcessor::RcFile::RcFile(const string& filename, int index) {
- filename_ = filename;
- index_ = index;
+OptionProcessor::RcFile::RcFile(const string& filename, int index)
+ : filename_(filename), index_(index) {
}
blaze_exit_code::ExitCode OptionProcessor::RcFile::Parse(