Solved

warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)

Posted on 2006-11-27
4
8,280 Views
Last Modified: 2013-11-20
Hi guys,

Got this warning:

warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)


Want to tidy it up, here's the line affected:


bool bResult = pDlg->CB_IsOurCustomBrowser();




What would I need to do?


Cheers!
0
Comment
Question by:Cyber-Drugs
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 30

Accepted Solution

by:
Axter earned 300 total points
ID: 18021613
Hi Cyber-Drugs,
> What would I need to do?

Try the following:
bool bResult = pDlg->CB_IsOurCustomBrowser()?true:false;

David Maisonave (Axter)
Cheers!
0
 
LVL 48

Assisted Solution

by:AlexFM
AlexFM earned 200 total points
ID: 18021631
What is return type of CB_IsOurCustomBrowser? If this is int or BOOL, this warning is shown, because int is casted to bool. Notice that BOOL is defined as int32 value, and bool is one byte. There are three ways to correct this:

BOOL bResult = pDlg->CB_IsOurCustomBrowser();

bool bResult = (pDlg->CB_IsOurCustomBrowser() != 0);

bool bResult = (bool)pDlg->CB_IsOurCustomBrowser();
0
 
LVL 4

Author Comment

by:Cyber-Drugs
ID: 18021653
Hi guys,

All of the solutions you posted worked, cheers! :)
0
 
LVL 2

Expert Comment

by:piyush_soni
ID: 21585849
This being said, I was just wondering, what would be the most efficient way to do this? No points ...just reply if you know and want to ....
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Installing Microsoft R server on REDHAT or SUSE Linux 4 162
matchUp  challenge 6 82
wait notify demo infinite loop 3 149
ERP and the other system process verification 5 25
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
In this post we will learn different types of Android Layout and some basics of an Android App.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question