vietjtnguyen / argagg

A simple C++11 command line argument parser
MIT License
224 stars 28 forks source link

Doc Issue #26

Closed rianquinn closed 3 years ago

rianquinn commented 4 years ago
argagg::parser_results args;
try {
  args = argparser.parse(argc, argv);
} catch (const std::exception& e) {
  std::cerr << e.what() << std::endl;
  return EXIT_FAILURE;
}

should be

argagg::parser_results args;
try {
  args = argparser.parse(argc, argv);
} catch (const std::exception& e) {
  std::cerr << e.what() << '\n';
  return EXIT_FAILURE;
}

When using std::cerr, the output is not buffered, and so std::endl is redundant. When using std::cout, you should only use std::endl as well when you explicitly need a flush, which is not often the case (i.e., normally, there isn't a good reason to use it)