-
Notifications
You must be signed in to change notification settings - Fork 10k
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
Refactor nested if causing error C1061 on MSVC. #6101
Conversation
common/common.cpp
Outdated
} | ||
|
||
return hash; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is C++14 - we support just C++11 (https://stackoverflow.com/questions/45097171/the-body-of-constexpr-function-not-a-return-statement)
Probably, just remove the else
s from the if-else chain - this is not performance critical code
@@ -151,13 +151,17 @@ bool gpt_params_parse_ex(int argc, char ** argv, gpt_params & params) { | |||
std::replace(arg.begin(), arg.end(), '_', '-'); | |||
} | |||
|
|||
bool arg_found = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Btw, to avoid this arg_found
everywhere, we should move this if-chain in a bool
function and return early on success
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll submit another PR.
* Refactor nested if causing error C1061 on MSVC. * Revert back and remove else's. * Add flag to track found arguments.
* Refactor nested if causing error C1061 on MSVC. * Revert back and remove else's. * Add flag to track found arguments.
This PR refactors the nested if-else using switch-case to resolve error C1061 using MSVC.
Note: there is also a temporary workaround provided by Deacon8 here #6096
Fixes #6093