Click here to Skip to main content
15,889,899 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Black Border around Dialog Box. Pin
Nishad S9-Oct-08 2:54
Nishad S9-Oct-08 2:54 
GeneralRe: Black Border around Dialog Box. Pin
gothic_coder9-Oct-08 3:01
gothic_coder9-Oct-08 3:01 
GeneralRe: Black Border around Dialog Box. Pin
Nishad S9-Oct-08 17:34
Nishad S9-Oct-08 17:34 
GeneralRe: Black Border around Dialog Box. Pin
gothic_coder9-Oct-08 21:29
gothic_coder9-Oct-08 21:29 
GeneralRe: Black Border around Dialog Box. Pin
Nishad S9-Oct-08 23:36
Nishad S9-Oct-08 23:36 
GeneralRe: Black Border around Dialog Box. Pin
gothic_coder10-Oct-08 0:32
gothic_coder10-Oct-08 0:32 
GeneralRe: Black Border around Dialog Box. Pin
Nishad S10-Oct-08 1:13
Nishad S10-Oct-08 1:13 
Questiondifferent result on x86 and x64 Pin
George_George8-Oct-08 20:43
George_George8-Oct-08 20:43 
Hello everyone,


For the following code, on x86 build, the output is

000000C8
000000C8

and on x64 build, the output is

CCCCCCCC000000C8
00000000000000C8

I think the reason is, for x64, both void* and void** are 64bit, for for x86 void* and void** are 32 bit, and for int, always 32bit for both x86 and x64.

This line of code "void* b2 = *b1", dereference b1 and makes it into 64-bit on x64, which concatenate value of a 0x000000C8 and previous DWORD 0xcccccccc, so forms the result 0xCCCCCCCC000000C8.

But on x86, when dereference b1 and makes it into 32-bit on x86, and recovers to original value 0x000000C8.

In my understanding correct?

#include <iostream>

using namespace std;

int main()
{

	int a = 200;

	void** b1 = (void**)&a;

	void* b2 = *b1;

	int b3 = (int)*b1;

	cout << (void*)b2 << endl;

	cout << (void*)b3 << endl;

	return 0;
}



thanks in advance,
George
AnswerRe: different result on x86 and x64 Pin
CPallini9-Oct-08 0:27
mveCPallini9-Oct-08 0:27 
GeneralRe: different result on x86 and x64 Pin
George_George9-Oct-08 0:58
George_George9-Oct-08 0:58 
GeneralRe: different result on x86 and x64 Pin
CPallini9-Oct-08 1:01
mveCPallini9-Oct-08 1:01 
GeneralRe: different result on x86 and x64 Pin
George_George9-Oct-08 1:08
George_George9-Oct-08 1:08 
GeneralRe: different result on x86 and x64 Pin
gscotti9-Oct-08 4:47
gscotti9-Oct-08 4:47 
GeneralRe: different result on x86 and x64 Pin
George_George9-Oct-08 18:41
George_George9-Oct-08 18:41 
AnswerRe: different result on x86 and x64 Pin
Chris Losinger9-Oct-08 9:17
professionalChris Losinger9-Oct-08 9:17 
GeneralRe: different result on x86 and x64 Pin
George_George9-Oct-08 18:42
George_George9-Oct-08 18:42 
QuestionBluebox - Chromakey etc Pin
Pixinger778-Oct-08 20:17
Pixinger778-Oct-08 20:17 
AnswerRe: Bluebox - Chromakey etc Pin
CPallini8-Oct-08 22:05
mveCPallini8-Oct-08 22:05 
Questionusing x86 Windbg on x64 machine Pin
George_George8-Oct-08 19:49
George_George8-Oct-08 19:49 
Questionprohbit shift key in edit box............ Pin
ani_ikram8-Oct-08 19:12
ani_ikram8-Oct-08 19:12 
AnswerRe: prohbit shift key in edit box............ Pin
Naveen8-Oct-08 19:22
Naveen8-Oct-08 19:22 
GeneralRe: prohbit shift key in edit box............ Pin
ani_ikram8-Oct-08 19:29
ani_ikram8-Oct-08 19:29 
GeneralRe: prohbit shift key in edit box............ Pin
Naveen8-Oct-08 19:34
Naveen8-Oct-08 19:34 
GeneralRe: prohbit shift key in edit box............ Pin
ani_ikram8-Oct-08 19:36
ani_ikram8-Oct-08 19:36 
GeneralRe: prohbit shift key in edit box............ Pin
Naveen8-Oct-08 19:45
Naveen8-Oct-08 19:45 

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.