Repository: google/benchmark
File: include/benchmark/benchmark.h (C/C++)

Code before:

  virtual ~BenchmarkReporter();

  // Write a human readable string to 'out' representing the specified
  // 'context'.
  // REQUIRES: 'out' is non-null.
  static void PrintBasicContext(std::ostream* out, Context const& context);

 private:
  std::ostream* output_stream_;
  std::ostream* error_stream_;
};

// Simple reporter that outputs benchmark data to the console. This is the
// default reporter used by RunSpecifiedBenchmarks().
class ConsoleReporter : public BenchmarkReporter {
 public:
  enum OutputOptions {
    OO_None = 0,
    OO_Color = 1,
    OO_Tabular = 2,
    OO_ColorTabular = OO_Color | OO_Tabular,
    OO_Defaults = OO_ColorTabular
  };
  explicit ConsoleReporter(OutputOptions opts_ = OO_Defaults)
      : output_options_(opts_),
        name_field_width_(0),
        prev_counters_(),
        printed_header_(false) {}

  virtual bool ReportContext(const Context& context) BENCHMARK_OVERRIDE;
  virtual void ReportRuns(const std::vector<Run>& reports) BENCHMARK_OVERRIDE;

 protected:
  virtual void PrintRunData(const Run& report);
  virtual void PrintHeader(const Run& report);

  OutputOptions output_options_;
  size_t name_field_width_;
  UserCounters prev_counters_;
  bool printed_header_;
};

class JSONReporter : public BenchmarkReporter {
 public:
  JSONReporter() : first_report_(true) {}
  virtual bool ReportContext(const Context& context) BENCHMARK_OVERRIDE;
  virtual void ReportRuns(const std::vector<Run>& reports) BENCHMARK_OVERRIDE;
  virtual void Finalize() BENCHMARK_OVERRIDE;

 private:

Review comment (bug):
I'm slightly suspicious of this change ... it's making these fields un-initted, no?
(I've just had to debug a problem very recently when I "forgot" to init the field and assume it'd be null/zero-initialised)

Code after:
  virtual ~BenchmarkReporter();

  // Write a human readable string to 'out' representing the specified
  // 'context'.
  // REQUIRES: 'out' is non-null.
  static void PrintBasicContext(std::ostream* out, Context const& context);

 private:
  std::ostream* output_stream_;
  std::ostream* error_stream_;
};

// Simple reporter that outputs benchmark data to the console. This is the
// default reporter used by RunSpecifiedBenchmarks().
class ConsoleReporter : public BenchmarkReporter {
 public:
  enum OutputOptions {
    OO_None = 0,
    OO_Color = 1,
    OO_Tabular = 2,
    OO_ColorTabular = OO_Color | OO_Tabular,
    OO_Defaults = OO_ColorTabular
  };
  explicit ConsoleReporter(OutputOptions opts_ = OO_Defaults)
      : output_options_(opts_), name_field_width_(0), printed_header_(false) {}

  virtual bool ReportContext(const Context& context) BENCHMARK_OVERRIDE;
  virtual void ReportRuns(const std::vector<Run>& reports) BENCHMARK_OVERRIDE;

 protected:
  virtual void PrintRunData(const Run& report);
  virtual void PrintHeader(const Run& report);

  OutputOptions output_options_;
  size_t name_field_width_;
  UserCounters prev_counters_;
  bool printed_header_;
};

class JSONReporter : public BenchmarkReporter {
 public:
  JSONReporter() : first_report_(true) {}
  virtual bool ReportContext(const Context& context) BENCHMARK_OVERRIDE;
  virtual void ReportRuns(const std::vector<Run>& reports) BENCHMARK_OVERRIDE;
  virtual void Finalize() BENCHMARK_OVERRIDE;

 private:
  void PrintRunData(const Run& report);

  bool first_report_;
};