Skip to content

Removing some useless else - #119

Merged
brarcher merged 2 commits into
masterfrom
unknown repository
May 3, 2017
Merged

Removing some useless else#119
brarcher merged 2 commits into
masterfrom
unknown repository

Conversation

@ghost

@ghost ghost commented Mar 6, 2017

Copy link
Copy Markdown

No description provided.

Comment thread src/check_list.c
return 1;
else
return (lp->current > lp->last);
return (lp->current > lp->last);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

return lp->current == -1 ? 1 : lp->current > lp->last;

If you want to reduce it even more...

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I do not remember to have seen ternary expression in the source code, so it may be intentional as it could be considered less clear. Moreover, it is also not supported by some weird compilers, or less well, especially the ones for embed systems. http://embeddedgurus.com/stack-overflow/2009/02/efficient-c-tips-6-dont-use-the-ternary-operator/

@brarcher

brarcher commented Mar 7, 2017

Copy link
Copy Markdown
Contributor

Jenkins: ok to test

@brarcher
brarcher merged commit ee2e866 into libcheck:master May 3, 2017
@ghost
ghost deleted the rm-useless-else branch May 4, 2017 10:17
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