Improve example AbslUnparseFlag().

1. Move default case outside switch.  This is a good practice because it allows -Wswitch to warn about missing enum values.

2. Use absl::StrCat() instead of (nonexistent) SimpleItoa().
pull/336/head
Michael Shields 6 years ago committed by GitHub
parent 43ef2148c0
commit 23dc759538
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      absl/flags/marshalling.h

@ -108,8 +108,8 @@
// switch (mode) { // switch (mode) {
// case kPlainText: return "plaintext"; // case kPlainText: return "plaintext";
// case kHtml: return "html"; // case kHtml: return "html";
// default: return SimpleItoa(mode);
// } // }
// return absl::SimpleItoa(mode);
// } // }
// //
// Notice that neither `AbslParseFlag()` nor `AbslUnparseFlag()` are class // Notice that neither `AbslParseFlag()` nor `AbslUnparseFlag()` are class

Loading…
Cancel
Save