ARG_TARGET
Description
Type-aware target tag generator. Inspects the pointee type of t via _Generic and produces an ArgTarget carrying the ArgKind plus the raw void pointer. Unknown target types fall through to ARG_KIND_INVALID and arg_register refuses the registration with a LOG_FATAL so the bug surfaces at startup rather than at parse time.
Note on i8: bool is typedef i8 bool in Misra/Types.h, so bool * and i8 * collide at the C type level and _Generic can’t disambiguate them. We map this single shared pointer type to ARG_KIND_BOOL (the cli-useful one). Anyone needing a tiny signed integer from the command line should reach for i16.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
ArgParse.h:238:
///
#define ArgRequired(parser, short_, long_, target, help_) \
arg_register((parser), ARG_ROLE_REQUIRED, (short_), (long_), (help_), ARG_TARGET(target))
///
- In
ArgParse.h:250:
///
#define ArgOptional(parser, short_, long_, target, help_) \
arg_register((parser), ARG_ROLE_OPTIONAL, (short_), (long_), (help_), ARG_TARGET(target))
///
- In
ArgParse.h:261:
///
#define ArgFlag(parser, short_, long_, target, help_) \
arg_register((parser), ARG_ROLE_FLAG, (short_), (long_), (help_), ARG_TARGET(target))
///
- In
ArgParse.h:273:
///
#define ArgCount(parser, short_, long_, target, help_) \
arg_register((parser), ARG_ROLE_COUNT, (short_), (long_), (help_), ARG_TARGET(target))
///
- In
ArgParse.h:288:
///
#define ArgPositional(parser, name, target, help_) \
arg_register((parser), ARG_ROLE_POSITIONAL, NULL, (name), (help_), ARG_TARGET(target))
#ifdef __cplusplus
Last updated on