Robert Hairgrove <bob <at> roberthairgrove.com> writes: > I am writing some little C++ wrapper classes for the argp functions. > Unfortunately, I cannot find any documentation of the argp_child::flags > member, i.e.: what possible values it could have. The only documentation > seems to be the one line comment in argp.h: "Flags for this child", which is > slightly less than helpful... > > One would think that it might take the same values as the flags argument to > the main argp_parse() function; however, that argument is unsigned, whereas > the argp_child member is declared as an int.
OK, digging around in the source code at argp_parse.c, I see that flags from argp_parse (which are unsigned) are passed verbatim to this function: static error_t parser_init (struct parser *parser, const struct argp *argp, int argc, char **argv, int flags, void *input); ...in the function __argp_parse(): /* Construct a parser for these arguments. */ err = parser_init (&parser, argp, argc, argv, flags, input); Maybe passing signed/unsigned arguments around without a cast is OK for C programs, but I think the documentation could be improved here to at least say what domain of values are used, and argp_child::flags should be declared unsigned as well.