Skip to content

Conversation

@lifang-zhang
Copy link

No description provided.

Some of the style check complains "WARNING:UNNECESSARY_ELSE: else
is not generally useful after a break or return".
else
options->optarg = 0;
return option[0];
default: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's not possible for optparse_argtype() to return anything other than -1 .. 2, so this case will never execute.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logically yes, but I encountered one case that returned 0 from line 263. I will come back to you if I can reproduce the problem.

By the way, isn't it so that optparse should return one of follwing values?

  • Option character, when an option is successfully parsed
  • -1: indicate all options have been parsed
  • '?': for invalid option

The return 0 in line 263 doesn't make that much sense?

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 this pull request may close these issues.

2 participants