> On May 20, 2015, 8:04 p.m., Joris Van Remoortere wrote: > > 3rdparty/libprocess/3rdparty/stout/include/stout/flags/flags.hpp, lines > > 383-387 > > <https://reviews.apache.org/r/34193/diff/2-3/?file=963013#file963013line383> > > > > What about: > > ``` > > programName_ = argc > 0 ? os::basename(argv[0]) : ""; > > ``` > > > > I assume you want to explicitly set the empty string in case something > > else has touched `programName_` before we call this function. I think this > > is great safe programming :-)
ok - thanks (for this and catching the above) I was actually "copying" a pattern I'd seen elsewhere in this file (I think) but maybe I got it wrong. This looks cleaner. > On May 20, 2015, 8:04 p.m., Joris Van Remoortere wrote: > > 3rdparty/libprocess/3rdparty/stout/include/stout/flags/flags.hpp, lines > > 95-99 > > <https://reviews.apache.org/r/34193/diff/2-3/?file=963013#file963013line95> > > > > I can't find other places in the code where we use a backtick rather > > than a single quote. Would you mind staying consistent? This makes it > > easier to refactor / search for code later. > > > > Here and elsehwere in the review. not sure I agree with the logic, but, sure, why not. - Marco ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/34193/#review84567 ----------------------------------------------------------- On May 19, 2015, 10:31 p.m., Marco Massenzio wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/34193/ > ----------------------------------------------------------- > > (Updated May 19, 2015, 10:31 p.m.) > > > Review request for mesos, Benjamin Hindman and Joris Van Remoortere. > > > Bugs: MESOS-2711 > https://issues.apache.org/jira/browse/MESOS-2711 > > > Repository: mesos > > > Description > ------- > > Jira: MESOS-2711 > > Every program that uses stout's `BaseFlags` ends up > re-implementing the `printUsage()` function, and adding > a `bool help` (and associated --help flag); this functionality > has now been refactored in the base class and is available everywhere. > > This change attempts to be backward-compatible, so it > does not alter the behavior of the program when --help is > invoked (by, eg, automatically printing usage and exiting) > but leaves up to the caller to check for `flags.help` and then > decide what action to take. > > There is now a default behavior for the "leader" ("Usage: <prog name> > [options]") > but the client API allows to modify that too. > > Note - anywhere I found the use of the `--help` flag the behavior was the > same: > print usage and exit (see also https://reviews.apache.org/r/34195). > > > Diffs > ----- > > 3rdparty/libprocess/3rdparty/stout/include/stout/flags/flags.hpp > fb383b463a99924483634eebf22bf34de318f920 > 3rdparty/libprocess/3rdparty/stout/tests/flags_tests.cpp > 00281195b53d2597bdb46e3fe6cd9d46a5e9b1f1 > > Diff: https://reviews.apache.org/r/34193/diff/ > > > Testing > ------- > > make check > > **NOTE** this change by itself breaks the build, because the --help is > redefined everywhere (16 places, as of last count): CL 34195 fixes that and > makes all build/tests pass. > > > Thanks, > > Marco Massenzio > >
