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

nng_opts_parse() uses const incorrectly #715

Closed
gdamore opened this issue Sep 10, 2018 · 0 comments
Closed

nng_opts_parse() uses const incorrectly #715

gdamore opened this issue Sep 10, 2018 · 0 comments
Milestone

Comments

@gdamore
Copy link
Contributor

gdamore commented Sep 10, 2018

The passing of the argv array as const char ** is wrong, and means you can't pass the normal arguments that you would from main(int argc, char **argv) without breaking things.

What is desired instead is char *const *.

This is the correct passing for C99.

gdamore added a commit to staysail/nng that referenced this issue Sep 12, 2018
The fix for nanomsg#715 to address const is still not quite right.

In ISO C, the argv array is just char **. getopt() in POSIX uses
char *const[]. That part is right, but we should then not pass
const char ** in calls. Furthermore, really the optarg should also
not be constified.

This aligns us closer to getopt() and leads to the fewest problems.
This does represent a slight breaking change, but as old code should
still compile and run, we don't think we should bump the API version
for this change.  Furthermore, we don't think anyone else is actually
using this API yet.
@gdamore gdamore added this to the v1.1 milestone Nov 6, 2018
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

No branches or pull requests

1 participant