Click here to Skip to main content
15,914,488 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralStrange Code in MFC Source Pin
Joel Matthias17-Apr-02 13:04
Joel Matthias17-Apr-02 13:04 
GeneralRe: Strange Code in MFC Source Pin
Shog917-Apr-02 13:07
sitebuilderShog917-Apr-02 13:07 
GeneralRe: Strange Code in MFC Source Pin
Gianfranco Lanzetta17-Apr-02 13:18
Gianfranco Lanzetta17-Apr-02 13:18 
GeneralRe: Strange Code in MFC Source Pin
l a u r e n17-Apr-02 21:13
l a u r e n17-Apr-02 21:13 
GeneralRe: Strange Code in MFC Source Pin
Michael Dunn17-Apr-02 13:33
sitebuilderMichael Dunn17-Apr-02 13:33 
GeneralRe: Strange Code in MFC Source Pin
Joel Matthias17-Apr-02 19:57
Joel Matthias17-Apr-02 19:57 
GeneralRe: Strange Code in MFC Source Pin
Stan Shannon17-Apr-02 13:34
Stan Shannon17-Apr-02 13:34 
GeneralRe: Strange Code in MFC Source Pin
Mike Nordell17-Apr-02 13:55
Mike Nordell17-Apr-02 13:55 
I've seen some comments here mixing Windows SDK BOOL and C++ bool.

To make that part perfectly clear, the second "!" inverts the logic of the statement it's applied to, first converting "m_bHelpMode" to a C++ bool and then negating that bool. The first "!" then negates/inverts that bool. So once "!m_bHelpMode" is evaluated the value of the expression is a plain C++ bool.

The whole expression if then converted to int (since according to MSDN SetCheck takes an int).

What it really says (or should say) is
pCmdUI->SetCheck(m_bHelpMode != FALSE ? 1 : 0);
Since as we all know true evaluates to the integral value 1 and false evaluates to the integral value 0.

You then touch on the area of optimizations. However mad it seems, MSVC6 actually generates different code for the following functions (go ahead, try both /O1 and /O2)!

bool foo1(int a) { return a == 0; }
bool foo2(int a) { return (a == 0) ? true : false; }

I'd love to see if this part of the MS Compiler optimizer has been fixed in VC7!
GeneralRe: Strange Code in MFC Source Pin
Tim Smith18-Apr-02 2:09
Tim Smith18-Apr-02 2:09 
GeneralMultithreading :: MFC Pin
valikac17-Apr-02 11:23
valikac17-Apr-02 11:23 
GeneralRe: Multithreading :: MFC Pin
Joaquín M López Muñoz17-Apr-02 11:51
Joaquín M López Muñoz17-Apr-02 11:51 
GeneralRe: Multithreading :: MFC Pin
valikac17-Apr-02 13:33
valikac17-Apr-02 13:33 
GeneralRe: Multithreading :: MFC Pin
Joaquín M López Muñoz17-Apr-02 19:52
Joaquín M López Muñoz17-Apr-02 19:52 
GeneralRe: Multithreading :: MFC Pin
valikac17-Apr-02 20:42
valikac17-Apr-02 20:42 
GeneralChanging Font sizes Pin
17-Apr-02 11:19
suss17-Apr-02 11:19 
GeneralRe: Changing Font sizes Pin
Shog917-Apr-02 11:27
sitebuilderShog917-Apr-02 11:27 
GeneralRe: Changing Font sizes Pin
17-Apr-02 13:15
suss17-Apr-02 13:15 
GeneralVisual Studio .Net - files in workspace aren't alphabetical Pin
Brit17-Apr-02 10:14
Brit17-Apr-02 10:14 
GeneralRe: Visual Studio .Net - files in workspace aren't alphabetical Pin
Mike Nordell17-Apr-02 10:43
Mike Nordell17-Apr-02 10:43 
GeneralRe: Visual Studio .Net - files in workspace aren't alphabetical Pin
Anders Molin17-Apr-02 11:59
professionalAnders Molin17-Apr-02 11:59 
GeneralRe: Visual Studio .Net - files in workspace aren't alphabetical Pin
Mike Nordell17-Apr-02 12:22
Mike Nordell17-Apr-02 12:22 
QuestionVirtual desktops? Pin
generic_user_id17-Apr-02 9:35
generic_user_id17-Apr-02 9:35 
AnswerRe: Virtual desktops? Pin
Mike Nordell17-Apr-02 9:54
Mike Nordell17-Apr-02 9:54 
GeneralRe: Virtual desktops? Pin
generic_user_id17-Apr-02 11:10
generic_user_id17-Apr-02 11:10 
GeneralRe: Virtual desktops? Pin
Mike Nordell17-Apr-02 11:59
Mike Nordell17-Apr-02 11:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.