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

C / C++ / MFC

 
GeneralSubclass popupmenu in another app Pin
Rahvin18-Apr-08 6:10
Rahvin18-Apr-08 6:10 
GeneralQuestion about CString Format Pin
KellyR18-Apr-08 5:19
KellyR18-Apr-08 5:19 
GeneralRe: Question about CString Format [modified] Pin
David Crow18-Apr-08 5:30
David Crow18-Apr-08 5:30 
GeneralRe: Question about CString Format Pin
CPallini18-Apr-08 5:35
mveCPallini18-Apr-08 5:35 
QuestionRe: Question about CString Format Pin
David Crow18-Apr-08 5:43
David Crow18-Apr-08 5:43 
GeneralRe: Question about CString Format Pin
KellyR18-Apr-08 5:50
KellyR18-Apr-08 5:50 
GeneralRe: Question about CString Format Pin
David Crow18-Apr-08 5:57
David Crow18-Apr-08 5:57 
GeneralRe: Question about CString Format Pin
CPallini18-Apr-08 6:32
mveCPallini18-Apr-08 6:32 
GeneralRe: Question about CString Format Pin
David Crow18-Apr-08 7:00
David Crow18-Apr-08 7:00 
GeneralRe: Question about CString Format Pin
CPallini18-Apr-08 5:31
mveCPallini18-Apr-08 5:31 
AnswerRe: Question about CString Format Pin
KellyR18-Apr-08 5:49
KellyR18-Apr-08 5:49 
QuestionHow to use the functions from DLL files Pin
pl_kode18-Apr-08 5:03
pl_kode18-Apr-08 5:03 
GeneralRe: How to use the functions from DLL files Pin
Hamid_RT18-Apr-08 5:12
Hamid_RT18-Apr-08 5:12 
GeneralRe: How to use the functions from DLL files Pin
CPallini18-Apr-08 5:26
mveCPallini18-Apr-08 5:26 
QuestionHow to get all controls of current dialog? Pin
mehmetned18-Apr-08 4:38
mehmetned18-Apr-08 4:38 
AnswerRe: How to get all controls of current dialog? Pin
David Crow18-Apr-08 4:49
David Crow18-Apr-08 4:49 
AnswerRe: How to get all controls of current dialog? Pin
Hamid_RT18-Apr-08 5:14
Hamid_RT18-Apr-08 5:14 
GeneralRe: How to get all controls of current dialog? Pin
mehmetned21-Apr-08 2:58
mehmetned21-Apr-08 2:58 
GeneralRe: How to get all controls of current dialog? Pin
Hamid_RT21-Apr-08 19:27
Hamid_RT21-Apr-08 19:27 
GeneralRe: How to get all controls of current dialog? Pin
ThatsAlok30-Jun-09 23:28
ThatsAlok30-Jun-09 23:28 
GeneralBriefcase shell context menu Pin
john563218-Apr-08 3:53
john563218-Apr-08 3:53 
GeneralRe: Briefcase shell context menu Pin
Iain Clarke, Warrior Programmer18-Apr-08 4:05
Iain Clarke, Warrior Programmer18-Apr-08 4:05 
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 
Hi,
I was trying to find some way to change a const value using pointers (just for the hell of it).
I guessed const is a compile time restriction and not a runtime one.
I came across this.
The code compiles and runs without any error.
It displays 12 20, even though the code suggests p and y must be having a value of 20.
I am surely missing something here. Please help.
<br />
void main()<br />
{	<br />
	int *px;<br />
        const int p = 12;<br />
	px = (int *)&p;<br />
	*px = 20;<br />
	int y = p;<br />
	cout << y << " " << *px;	<br />
}


Then I tried this.
I made p a global variable. This one compiles without any error or warnings(highest level).
However throws access violation on *px = 20; at runtime! This is against my (wrong?) understanding of const.
Please can someone throw some light on this issue?

<br />
const int p = 12;<br />
void main()<br />
{	<br />
	int *px;        <br />
	px = (int *)&p;<br />
	*px = 20;<br />
	int y = p;<br />
	cout << y << " " << *px;	<br />
}<br />


I used MSVS 6.0 compiler.

modified on Friday, April 18, 2008 9:38 AM

GeneralRe: const issue... Pin
David Crow18-Apr-08 4:47
David Crow18-Apr-08 4:47 

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.