-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
fixed cpplint errors about string& members #2929
fixed cpplint errors about string& members #2929
Conversation
@jameslamb maybe |
@guolinke sure I can switch to a pointer |
@guolinke I've been trying this and honestly I think changing to |
I can directly try on this PR @jameslamb |
@jameslamb my fix is in https://github.com/microsoft/LightGBM/tree/jameslamb/cpplint/explicit-constructors, could you sync to your repo? |
7e7735f
to
675d663
Compare
@guolinke I just merged your changes into my branch (and then rebased to Unfortunately I still see the warning:
|
close re-open to trigger CI. This PR got caught in the Travis outage |
@jameslamb oh, I will refix it. updated: done. |
Seems this PR increases number of errors to 41. |
@jameslamb could you update the branch ? |
I just merged this branch with current |
@jameslamb oh, sorry, i mean this branch: https://github.com/microsoft/LightGBM/tree/jameslamb/cpplint/explicit-constructors |
ah sorry! Just merged your changes into this branch: a9a2556 I checked |
@@ -165,7 +165,7 @@ class Value : public JsonValue { | |||
return m_value == static_cast<const Value<tag, T> *>(other)->m_value; | |||
} | |||
bool less(const JsonValue * other) const override { | |||
return m_value < static_cast<const Value<tag, T> *>(other)->m_value; | |||
return m_value < (static_cast<const Value<tag, T> *>(other)->m_value); |
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.
@guolinke the only thing I changed in your code was adding these parentheses. My editor was complaining because it interpreted that first <
as the beginning of a cast instead of a logical operator 😆
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.
Thank you guys!
-1 cpplint error 🙂
This pull request has been automatically locked since there has not been any recent activity since it was closed. To start a new related discussion, open a new issue at https://github.com/microsoft/LightGBM/issues including a reference to this. |
In this PR, I'd like to propose a fix for this
cpplint
error (from #1990)Currently,
json11
takes in the string to be parsed by reference:From what I can tell googling around, I think that
cpplint
thinks this is dangerous because even though you're declaring it asconst
, it can be a reference to any part of memory (not just a read-only part like aconst string
) so there is still an opportunity to change the value at that reference.These changes would take us down to 39 cpplint errors (43 in the log below because #2920 and #2927 are awaiting review).
cpplint log (click me)