-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Implicit type conversion warnings. #4189
Implicit type conversion warnings. #4189
Conversation
@@ -169,7 +169,7 @@ A clampedMultiply(const A& a, const B& b) { | |||
} | |||
|
|||
template<typename PixelType> | |||
float ofColor_<PixelType>::limit() { | |||
PixelType ofColor_<PixelType>::limit() { |
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 kind of dangerous, i'm pretty sure in some places we are doing things like:
value/limit()
to normalize a value and this change will break those places for integer numbers, casting this to float would avoid that and the warning.
in general i'm a little nervous about this changes of the types being used, if it's to solve warnings i guess we need to do it but otherwise i would hold until 0.9 is released so we have more time to test. it's usually really big commits and even if most changes are innocuous, things like this can really easily slip through.
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.
Yeah, I'll revert this one and we can cast where needed and test after 0.9.0.
…ks into implicit-type-conversion-warnings
@arturoc I reverted the return type. |
@@ -735,11 +735,11 @@ char ofToChar(const string& charString); | |||
template <class T> | |||
string ofToBinary(const T& value) { | |||
ostringstream out; | |||
const char* data = (const char*) &value; | |||
const unsigned long long* data = static_cast<unsigned long long*>(&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.
is this change well tested? don't wont to merge something that might break at this point but if this fixes warnings i'll do it. also can you change unsigned long long with uint64_t?
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.
Yeah, it's the default argument for the bitset, so it definitely gets rid of warnings. I'll update to the more compact type.
…ks into implicit-type-conversion-warnings
@arturoc this should be ready to go now. |
Implicit type conversion warnings.
No description provided.