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

Fix a cast warning when compiling with MSVC #722

Merged
merged 1 commit into from
Aug 12, 2014

Conversation

lioncash
Copy link
Member

@lioncash lioncash commented Aug 2, 2014

Would previously give a C4800 warning.

@Tilka
Copy link
Member

Tilka commented Aug 3, 2014

I'm more used to !!x but that's just me.

@lioncash
Copy link
Member Author

lioncash commented Aug 3, 2014

Oh right, I forgot about that way of doing it. Just a sec.

Would previously give a C4800 warning.
@Tilka
Copy link
Member

Tilka commented Aug 3, 2014

Warning is gone on the buildbot, lgtm.

@lioncash What about the other 88 or so instances of this particular warning?

@delroth
Copy link
Member

delroth commented Aug 3, 2014

Does this warning really provide any value? I'd be in favor of just disabling it.

@Tilka
Copy link
Member

Tilka commented Aug 7, 2014

As I understand it, this warning only exists to make people aware that an assignment like this has a runtime cost and might be avoidable by propagating the bool type. That's pretty obvious and I'm in favor of disabling it.

@shuffle2
Copy link
Contributor

The warning is because typically the conversion to bool is used when you want to test for true or false. But, the compiler must first cast the source type to bool and then test that result. Essentially that amounts to testing the value twice. This may or may not actually result in runtime overhead (actually, it's pretty unlikely).
However, the warning is good for detecting when you are implicitly converting a function argument to bool. This can alert you about the wrong function/template being selected, or that the code should just be reworked to use the correct types.

Anyways, lgtm.

shuffle2 added a commit that referenced this pull request Aug 12, 2014
Fix a cast warning when compiling with MSVC
@shuffle2 shuffle2 merged commit 4e73dd2 into dolphin-emu:master Aug 12, 2014
@lioncash lioncash deleted the casts branch August 12, 2014 20:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants