Click here to Skip to main content
15,890,670 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralWH_CBT Hook - Transparent Menues Pin
Rahvin18-Apr-08 3:36
Rahvin18-Apr-08 3:36 
Questionconst issue... [modified] Pin
paulstandard18-Apr-08 3:29
paulstandard18-Apr-08 3:29 
GeneralRe: const issue... Pin
David Crow18-Apr-08 4:47
David Crow18-Apr-08 4:47 
GeneralRe: const issue... Pin
paulstandard18-Apr-08 5:01
paulstandard18-Apr-08 5:01 
GeneralRe: const issue... Pin
Matthew Faithfull18-Apr-08 6:49
Matthew Faithfull18-Apr-08 6:49 
GeneralRe: const issue... Pin
CPallini18-Apr-08 9:10
mveCPallini18-Apr-08 9:10 
Generalthat answers problem 2...thanks Mathew [modified] Pin
paulstandard18-Apr-08 9:56
paulstandard18-Apr-08 9:56 
Generalcause of problem one ... Pin
paulstandard18-Apr-08 10:35
paulstandard18-Apr-08 10:35 
<br />
void main()<br />
{ <br />
int *px;<br />
const int p = 99;<br />
px = (int *)&p;<br />
*px = 77;<br />
int y = p;<br />
}<br />

I did a disassembly of the above (VS 6 debug disassembly window) and this is what I found.
bit strange, I didnt expect the compiler to replace every instance of 'p' with its value like a #define.
I mean, I expected
<br />
0040127E   mov         dword ptr [ebp-0Ch],dword ptr [ebp-8] <br />

instead of
<br />
0040127E   mov         dword ptr [ebp-0Ch],63h<br />


complete disassembly

<br />
00401268   mov         dword ptr [ebp-8],63h<br />
16:   px = (int *)&p;<br />
0040126F   lea         eax,[ebp-8]<br />
00401272   mov         dword ptr [ebp-4],eax<br />
17:   *px = 77;<br />
00401275   mov         ecx,dword ptr [ebp-4]<br />
00401278   mov         dword ptr [ecx],4Dh<br />
18:   int y = p;<br />
0040127E   mov         dword ptr [ebp-0Ch],63h<br />

QuestionHow to get rid of these errors [modified] Pin
pl_kode18-Apr-08 3:25
pl_kode18-Apr-08 3:25 
GeneralRe: How to get rid of these errors Pin
David Crow18-Apr-08 4:01
David Crow18-Apr-08 4:01 
QuestionRe: How to get rid of these errors Pin
CPallini18-Apr-08 4:02
mveCPallini18-Apr-08 4:02 
GeneralRe: How to get rid of these errors Pin
pl_kode18-Apr-08 4:24
pl_kode18-Apr-08 4:24 
QuestionRe: How to get rid of these errors Pin
David Crow18-Apr-08 4:43
David Crow18-Apr-08 4:43 
GeneralRe: How to get rid of these errors Pin
pl_kode18-Apr-08 5:00
pl_kode18-Apr-08 5:00 
QuestionRe: How to get rid of these errors Pin
David Crow18-Apr-08 5:07
David Crow18-Apr-08 5:07 
GeneralRe: How to get rid of these errors Pin
Iain Clarke, Warrior Programmer18-Apr-08 4:10
Iain Clarke, Warrior Programmer18-Apr-08 4:10 
QuestionMultiGraph Programming in VC++ Pin
Andy Rama18-Apr-08 2:40
Andy Rama18-Apr-08 2:40 
QuestionHow can I read the attributes of files? Pin
ritz123418-Apr-08 2:23
ritz123418-Apr-08 2:23 
AnswerRe: How can I read the attributes of files? Pin
Rajesh R Subramanian18-Apr-08 2:45
professionalRajesh R Subramanian18-Apr-08 2:45 
AnswerRe: How can I read the attributes of files? Pin
David Crow18-Apr-08 2:55
David Crow18-Apr-08 2:55 
GeneralRe: How can I read the attributes of files? Pin
ritz123418-Apr-08 3:05
ritz123418-Apr-08 3:05 
QuestionRe: How can I read the attributes of files? Pin
David Crow18-Apr-08 3:09
David Crow18-Apr-08 3:09 
GeneralRe: How can I read the attributes of files? Pin
ritz123418-Apr-08 3:12
ritz123418-Apr-08 3:12 
GeneralRe: How can I read the attributes of files? Pin
David Crow18-Apr-08 3:18
David Crow18-Apr-08 3:18 
GeneralRe: How can I read the attributes of files? Pin
ritz123418-Apr-08 3:42
ritz123418-Apr-08 3:42 

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.