Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2006-11-27
4
Medium Priority
?
8,365 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 1200 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 800 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Suggested Courses

721 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