Click here to Skip to main content
15,913,027 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: CString concatenation problem Pin
penny black14-Jun-07 3:34
penny black14-Jun-07 3:34 
QuestionRe: CString concatenation problem Pin
David Crow13-Jun-07 6:21
David Crow13-Jun-07 6:21 
AnswerRe: CString concatenation problem Pin
penny black14-Jun-07 3:36
penny black14-Jun-07 3:36 
Questionproblem with ifstream Pin
Yonggoo13-Jun-07 5:42
Yonggoo13-Jun-07 5:42 
AnswerRe: problem with ifstream Pin
David Crow13-Jun-07 5:57
David Crow13-Jun-07 5:57 
GeneralRe: problem with ifstream(more details?) Pin
Yonggoo13-Jun-07 6:03
Yonggoo13-Jun-07 6:03 
GeneralRe: problem with ifstream(more details?) Pin
David Crow13-Jun-07 6:16
David Crow13-Jun-07 6:16 
QuestionVisual Studio debugger telling me wrong information Pin
Cyrilix13-Jun-07 5:35
Cyrilix13-Jun-07 5:35 
The following is my code for when I click on a button that's labeled "Start". I use a functor to call my class member function pointer (via Execute(), where Execute() takes an int& parameter). When I set a breakpoint at the Execute() calls, and I hover my mouse over "i", the MSVC debugger tells me that i has some really high value like 4632955, and when I check &i in the immediate window, it tells me the memory address of i. Then, I go into Execute() to call the specific function pointer &MainWindow::DoWork, when I check the input parameter (which takes an int& as mentioned earlier), the memory address of that input parameter is &i + 4 bytes. Basically, what I'm saying is that MSVC shows me different memory address values from the calling function ButtonStart() and within the called function DoWork(). The value from ButtonStart() is wrong, as my int is not some really high number, but the value that is actually received in DoWork() is right, and ends up being 5 (what I set it to in the beginning). This is the first problem and I don't know why this is happening.

The second problem is that some of my lines of execution are being skipped. Actually, that is inaccurate, as they are being executed but I cannot set a breakpoint at some of the lines such as the line int i = 5. MSVC will just shift my breakpoint down to the Execute() calls. My debugging info is turned on, and I'm am building in Debug mode, so this shouldn't happen (I've had it happen when building in Release mode).

void MainWindow::ButtonStart()
{
	if (!m_threadPool && !m_source && !m_receiver)
	{
		//Initialize thread handler
		m_source = new EventSource();
		m_receiver = new EventReceiver();
		m_threadPool = new ThreadPool(m_source, m_receiver);

		//Hook thread handler termination event
		m_receiver->HookThreadPool(m_source);

		int i = 5;
		CallbackWrapperSpecific<MainWindow, void (MainWindow::*)(int&), int> cbwsPtr(this, &MainWindow::DoWork);
		CallbackWrapperBase<int>* cbwbPtr = &cbwsPtr;
		cbwbPtr->Execute(i);
		cbwbPtr->Execute(i);
	}
}

QuestionRe: Visual Studio debugger telling me wrong information Pin
David Crow13-Jun-07 6:19
David Crow13-Jun-07 6:19 
AnswerRe: Visual Studio debugger telling me wrong information Pin
Cyrilix13-Jun-07 6:35
Cyrilix13-Jun-07 6:35 
AnswerProblem Fixed -- optimization (/O2) causes these problems Pin
Cyrilix13-Jun-07 6:49
Cyrilix13-Jun-07 6:49 
GeneralRe: Problem Fixed -- optimization (/O2) causes these problems Pin
David Crow13-Jun-07 6:53
David Crow13-Jun-07 6:53 
GeneralRe: Problem Fixed -- optimization (/O2) causes these problems Pin
Cyrilix13-Jun-07 7:02
Cyrilix13-Jun-07 7:02 
Questionutyutyuytuutyutyutyuutyutyutyutyutyutyu/,.//,./, Pin
suchon_phuong13-Jun-07 5:33
suchon_phuong13-Jun-07 5:33 
AnswerRe: utyutyuytuutyutyutyuutyutyutyutyutyutyu/,.//,./, Pin
Cedric Moonen13-Jun-07 7:11
Cedric Moonen13-Jun-07 7:11 
QuestionDraw a cube Pin
gentleguy13-Jun-07 5:18
gentleguy13-Jun-07 5:18 
AnswerRe: Draw a cube Pin
Dustin Henry13-Jun-07 6:51
Dustin Henry13-Jun-07 6:51 
QuestionOnMouseMove HELP Please Pin
Charlie Curtis13-Jun-07 3:39
Charlie Curtis13-Jun-07 3:39 
AnswerRe: OnMouseMove HELP Please [modified] Pin
Mark Salsbery13-Jun-07 7:19
Mark Salsbery13-Jun-07 7:19 
QuestionC++ Thread Memory States/References Pin
Eshazear13-Jun-07 3:36
Eshazear13-Jun-07 3:36 
AnswerRe: C++ Thread Memory States/References Pin
James R. Twine13-Jun-07 3:46
James R. Twine13-Jun-07 3:46 
GeneralRe: C++ Thread Memory States/References Pin
Eshazear13-Jun-07 4:13
Eshazear13-Jun-07 4:13 
GeneralRe: C++ Thread Memory States/References Pin
Roger Stoltz13-Jun-07 4:35
Roger Stoltz13-Jun-07 4:35 
GeneralMultithreaded aproaches Pin
Eshazear13-Jun-07 4:45
Eshazear13-Jun-07 4:45 
QuestionVolatile Array allocation on the heap? Pin
Eshazear14-Jun-07 1:33
Eshazear14-Jun-07 1:33 

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.