Click here to Skip to main content
15,917,454 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: waveInPrepareHeader increases handle Pin
Joe Woodbury13-May-04 8:59
professionalJoe Woodbury13-May-04 8:59 
GeneralRe: waveInPrepareHeader increases handle Pin
13-May-04 10:38
suss13-May-04 10:38 
GeneralRbuttonDown and OnCommand Pin
doctorpi13-May-04 4:58
doctorpi13-May-04 4:58 
GeneralRe: RbuttonDown and OnCommand Pin
toxcct13-May-04 5:19
toxcct13-May-04 5:19 
GeneralRe: RbuttonDown and OnCommand Pin
doctorpi13-May-04 5:22
doctorpi13-May-04 5:22 
GeneralRe: RbuttonDown and OnCommand Pin
toxcct13-May-04 5:27
toxcct13-May-04 5:27 
GeneralRe: RbuttonDown and OnCommand Pin
doctorpi13-May-04 5:34
doctorpi13-May-04 5:34 
GeneralRe: RbuttonDown and OnCommand Pin
David Crow13-May-04 6:39
David Crow13-May-04 6:39 
GeneralRe: RbuttonDown and OnCommand Pin
doctorpi13-May-04 7:03
doctorpi13-May-04 7:03 
GeneralRe: RbuttonDown and OnCommand Pin
David Crow13-May-04 6:55
David Crow13-May-04 6:55 
GeneralRe: RbuttonDown and OnCommand Pin
doctorpi13-May-04 7:22
doctorpi13-May-04 7:22 
GeneralRe: RbuttonDown and OnCommand Pin
David Crow13-May-04 9:18
David Crow13-May-04 9:18 
GeneralRe: RbuttonDown and OnCommand Pin
doctorpi13-May-04 9:23
doctorpi13-May-04 9:23 
GeneralRe: RbuttonDown and OnCommand Pin
David Crow13-May-04 9:26
David Crow13-May-04 9:26 
GeneralRe: RbuttonDown and OnCommand Pin
doctorpi13-May-04 9:34
doctorpi13-May-04 9:34 
GeneralRe: RbuttonDown and OnCommand Pin
vividtang13-May-04 23:01
vividtang13-May-04 23:01 
GeneralNT drive mapping. Pin
RobJones13-May-04 4:21
RobJones13-May-04 4:21 
GeneralRe: NT drive mapping. Pin
Antony M Kancidrowski13-May-04 4:54
Antony M Kancidrowski13-May-04 4:54 
GeneralRe: NT drive mapping. Pin
Antony M Kancidrowski13-May-04 4:56
Antony M Kancidrowski13-May-04 4:56 
GeneralUSB Pin
Jeff Bogan13-May-04 3:58
Jeff Bogan13-May-04 3:58 
GeneralRe: USB Pin
Antti Keskinen13-May-04 6:13
Antti Keskinen13-May-04 6:13 
GeneralRe: USB Pin
Jeff Bogan13-May-04 7:56
Jeff Bogan13-May-04 7:56 
GeneralEdit Boc Scrolling Pin
sweep12313-May-04 3:13
sweep12313-May-04 3:13 
QuestionA funny thing happened to me. Who can explain? Pin
nguyenvhn13-May-04 1:40
nguyenvhn13-May-04 1:40 
When doing my homework, I had this code:
<br />
....<br />
int main(){<br />
	const int a=10;<br />
	int* p=(int*)&a;<br />
	*p=100;<br />
	int i=a;<br />
	cout << "p=" << p <<  endl;<br />
	cout << "&a=" << &a << endl;<br />
	cout << "*p=" << *p << endl;<br />
	cout << "a=" << a << endl;<br />
	cout << "i=" << i << endl;<br />
return 0;<br />
}<br />


Here is the output:

p=0012FF7C
&a=0012FF7C
*p=100
a=10
i=10

I guessed that a had to be 100, but it's 10.
It seem that compiler has replaced all instance of variable a to 10 at compile time, event if a has been allocated a storage. So the trick to change a constant by casting its pointer is not effect. Is that right?

Any comment is welcome.
Thanks.
AnswerRe: A funny thing happened to me. Who can explain? Pin
V.13-May-04 2:11
professionalV.13-May-04 2:11 

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.