Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why the memmove at the end of argparse ? #3

Closed
UffeJakobsen opened this issue Jun 20, 2014 · 3 comments · Fixed by #22
Closed

Why the memmove at the end of argparse ? #3

UffeJakobsen opened this issue Jun 20, 2014 · 3 comments · Fixed by #22

Comments

@UffeJakobsen
Copy link

Hi,

Why the memmove at the end of argparse ?
It destroys the original argv array

@cofyc
Copy link
Owner

cofyc commented Jun 20, 2014

To remove parsed command-line arguments. For example, <command> [-<s>|--switch]... files, remaining arguments are files only, it's convenient to separate switches and files arguments.

@UffeJakobsen
Copy link
Author

You do realize that you by that approach destroy the original look of that process in process listings such at "ps -ef", "top" ?

That is not very "compatible" - there are other more non-intrusive approaches:

The getopt() approach return an index indicating how far into the argv[] you have processed

@PitterL
Copy link

PitterL commented Sep 2, 2018

There will be warning when compile with vs2017 express:
argparse.c(281): warning C4090: 'function': different 'const' qualifiers

in struct out is announced as "const char **out", there is a "const" declaration, but you change the content at memmove() operation?

cofyc added a commit that referenced this issue Nov 23, 2018
@cofyc cofyc mentioned this issue Nov 23, 2018
cofyc added a commit that referenced this issue Nov 23, 2018
cofyc added a commit that referenced this issue Nov 23, 2018
sn1kketysnake pushed a commit to sn1kketysnake/argparse that referenced this issue Mar 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants