foxpy / qc

Quad C: Custom Cruel C Crate
MIT License
4 stars 0 forks source link

argument parsing library: no way to accept variable length number of positional arguments #9

Closed foxpy closed 3 years ago

foxpy commented 3 years ago

Consider this example:

cat -v main.cpp config.hpp utils.cpp

User is encouraged to do something monstrous like this:

qc_args* args = qc_args_new();
char** positionals = malloc(sizeof(char*)*INT_MAX);
for (int i = 0; i < INT_MAX; ++i) {
  qc_args_positional(args, &positionals[i]);
}

to get access to all positional arguments possible.

At this point there is no sane explanation why wouldn't one parse argv[static argc] array by itself.