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

Implicit type conversion warnings. #4189

Merged

Conversation

bakercp
Copy link
Member

@bakercp bakercp commented Aug 5, 2015

No description provided.

@@ -169,7 +169,7 @@ A clampedMultiply(const A& a, const B& b) {
}

template<typename PixelType>
float ofColor_<PixelType>::limit() {
PixelType ofColor_<PixelType>::limit() {
Copy link
Member

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.

Copy link
Member Author

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.

@bakercp
Copy link
Member Author

bakercp commented Aug 5, 2015

@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);
Copy link
Member

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?

Copy link
Member Author

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.

@bakercp
Copy link
Member Author

bakercp commented Aug 16, 2015

@arturoc this should be ready to go now.

arturoc added a commit that referenced this pull request Aug 16, 2015
@arturoc arturoc merged commit 50fd501 into openframeworks:master Aug 16, 2015
@bakercp bakercp deleted the implicit-type-conversion-warnings branch August 19, 2015 15:15
@kylemcdonald kylemcdonald mentioned this pull request Nov 1, 2015
6 tasks
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