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

Remove compilation warning from Median library #588

Merged

Conversation

martinkersner
Copy link
Member

Description

Solidity compiler is not able to understand that infinity loop never finishes, therefore it assumes that there is a chance that return variable might not be initialized and warns about that during compilation step. It recommends to name the variable which we cannot do in our case because we are reusing the same input parameter as return value as well.

According to ethereum/solidity#13746, we can simply add a revert() statement that notifies compiler with a zero cost that loop will never break, therefore we do not need to add an additional return statement after an infinite loop.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

Checklist before requesting a review

  • I have performed a self-review of my code.

@martinkersner martinkersner self-assigned this Apr 29, 2023
@martinkersner martinkersner linked an issue Apr 29, 2023 that may be closed by this pull request
@martinkersner martinkersner merged commit 2032226 into master Apr 29, 2023
@martinkersner martinkersner deleted the i-587/feat/remove-compilation-warning-from-median branch April 29, 2023 07:27
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.

Remove compilation warning from Median
1 participant