Click here to Skip to main content
15,922,166 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Common controls and manifests Pin
David Crow31-Aug-12 6:54
David Crow31-Aug-12 6:54 
GeneralRe: Common controls and manifests Pin
Jochen Arndt1-Sep-12 1:22
professionalJochen Arndt1-Sep-12 1:22 
GeneralRe: Common controls and manifests Pin
David Crow1-Sep-12 6:43
David Crow1-Sep-12 6:43 
GeneralRe: Common controls and manifests Pin
Jochen Arndt1-Sep-12 21:18
professionalJochen Arndt1-Sep-12 21:18 
QuestionMove the slider to the position where user clicked the mouse. Pin
mbatra3130-Aug-12 22:53
mbatra3130-Aug-12 22:53 
QuestionVC2008 Windows Service Mouse Hook Pin
tianguangjiangary30-Aug-12 21:57
tianguangjiangary30-Aug-12 21:57 
QuestionHigher floating point precison in C++ Pin
afalco30-Aug-12 3:54
afalco30-Aug-12 3:54 
AnswerRe: Higher floating point precison in C++ Pin
David Crow30-Aug-12 4:22
David Crow30-Aug-12 4:22 
GeneralRe: Higher floating point precison in C++ Pin
afalco30-Aug-12 20:59
afalco30-Aug-12 20:59 
GeneralRe: Higher floating point precison in C++ Pin
CPallini31-Aug-12 5:53
mveCPallini31-Aug-12 5:53 
GeneralRe: Higher floating point precison in C++ Pin
afalco2-Sep-12 21:32
afalco2-Sep-12 21:32 
QuestionHelp to find an excesive memory allocation in my application Pin
mklon2230-Aug-12 0:11
mklon2230-Aug-12 0:11 
AnswerRe: Help to find an excesive memory allocation in my application Pin
Alan Balkany30-Aug-12 7:47
Alan Balkany30-Aug-12 7:47 
AnswerRe: Help to find an excesive memory allocation in my application Pin
Rolf Kristensen30-Aug-12 7:55
Rolf Kristensen30-Aug-12 7:55 
AnswerRe: Help to find an excesive memory allocation in my application Pin
jschell30-Aug-12 8:35
jschell30-Aug-12 8:35 
QuestionMFC how to popup menu when i right click leaf node which is under the root node Pin
Member 934498629-Aug-12 23:24
Member 934498629-Aug-12 23:24 
AnswerRe: MFC how to popup menu when i right click leaf node which is under the root node Pin
Richard MacCutchan29-Aug-12 23:29
mveRichard MacCutchan29-Aug-12 23:29 
GeneralRe: MFC how to popup menu when i right click leaf node which is under the root node Pin
Member 934498630-Aug-12 22:12
Member 934498630-Aug-12 22:12 
QuestionHow to avoid message Queue on click event? Pin
Le@rner29-Aug-12 19:34
Le@rner29-Aug-12 19:34 
AnswerRe: How to avoid message Queue on click event? Pin
Jochen Arndt30-Aug-12 0:53
professionalJochen Arndt30-Aug-12 0:53 
GeneralRe: How to avoid message Queue on click event? Pin
Le@rner31-Aug-12 20:35
Le@rner31-Aug-12 20:35 
QuestionEnumFontFamiliesEx only returns one font -- SOLVED Pin
Alan Balkany29-Aug-12 8:49
Alan Balkany29-Aug-12 8:49 
AnswerRe: EnumFontFamiliesEx only returns one font -- SOLVED Pin
Alan Balkany29-Aug-12 8:53
Alan Balkany29-Aug-12 8:53 
Questionfunny with boost::tribool Pin
Robin Imrie29-Aug-12 6:44
professionalRobin Imrie29-Aug-12 6:44 
can any one explain why this code...

C++
#include <boost\logic\tribool.hpp>

using namespace boost;
using namespace std;

tribool test1();
tribool test2();

int _tmain(int argc, _TCHAR* argv[])
{
	if( !test1() || !test2() )
		cout << "test failed" << endl;
	
	return 0;
}

tribool test1()
{
	cout << "test1" << endl;
	return true;
}

tribool test2()
{
	cout << "test2" << endl;
	return false;
}


gives the following output..
test2
test1
test failed

According to the documentation on the || operator the
The operands of logical-AND and logical-OR expressions are evaluated from left to right. If the value of the first operand is sufficient to determine the result of the operation, the second operand is not evaluated. This is called "short-circuit evaluation." There is a sequence point after the first operand. See Sequence Points for more information. 


I fixed the "bug" by changing my if statement to

C++
if( !static_cast<bool>(test1()) || !static_cast<bool>(test2()) )


I did notice in the disassembly that the boost function boost::logic::operator|| was being called and wonder if this what was effecting my logic.

Thanks in advance
Thanks,
Robin.

AnswerRe: funny with boost::tribool (modified) Pin
Chris Meech29-Aug-12 7:14
Chris Meech29-Aug-12 7:14 

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.