Click here to Skip to main content
15,887,477 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: update the value of edit box Pin
krmed6-May-08 0:44
krmed6-May-08 0:44 
GeneralRe: update the value of edit box Pin
shohel8996-May-08 1:30
shohel8996-May-08 1:30 
Questionrelated files of CDaoDatabase Pin
includeh105-May-08 18:14
includeh105-May-08 18:14 
AnswerRe: related files of CDaoDatabase Pin
Rajesh R Subramanian5-May-08 18:35
professionalRajesh R Subramanian5-May-08 18:35 
GeneralIt is not working Pin
includeh105-May-08 19:29
includeh105-May-08 19:29 
AnswerRe: It is not working Pin
Rajesh R Subramanian5-May-08 19:34
professionalRajesh R Subramanian5-May-08 19:34 
AnswerRe: related files of CDaoDatabase Pin
Ozer Karaagac5-May-08 22:17
professionalOzer Karaagac5-May-08 22:17 
QuestionInteresting results with consts and pointers... Pin
frozenkore5-May-08 17:44
frozenkore5-May-08 17:44 
Here is an interesting bit of code:
<br />
void f(const int& i)<br />
{<br />
   int* ip = (int*)(&i);<br />
   (*ip)++;<br />
}<br />
int main()<br />
{<br />
   int i = 0;<br />
<br />
   cout << "i in main before f() is: " << i << endl;<br />
   f(i);<br />
   cout << "i in main after f() is: " << i << endl;<br />
   return 0;<br />
}<br />


and even more interesting is:

<br />
int main()<br />
{<br />
   const int i = 0;<br />
<br />
   int* ip = (int*)&i;<br />
   (*ip) = 65418;<br />
<br />
   cout << "Address of i  = " << &i << endl;<br />
   cout << "Address ip points to = " << ip << endl;<br />
   cout << "Value of i = " << i << endl;<br />
   cout << "Value ip of the address ip points to = " << *ip << endl;<br />
   return 0;<br />
}<br />
<br />


The question is, what's happening? I'm still looking into this. Just thought I'd toss is out to see what others thought.

Also, this makes for an interesting security question. If you are given pre-defined function declaration such as: void f(const int& i) or a constant reference to a struct, what keeps the coders from changing information internally.Confused | :confused:

Cheers!
AnswerRe: Interesting results with consts and pointers... Pin
Dan5-May-08 21:31
Dan5-May-08 21:31 
AnswerRe: Interesting results with consts and pointers... Pin
CPallini5-May-08 21:50
mveCPallini5-May-08 21:50 
AnswerRe: Interesting results with consts and pointers... Pin
markkuk6-May-08 0:22
markkuk6-May-08 0:22 
AnswerRe: Interesting results with consts and pointers... Pin
Mark Salsbery6-May-08 6:05
Mark Salsbery6-May-08 6:05 
QuestionSQL statement error: update record, why? Pin
includeh105-May-08 15:22
includeh105-May-08 15:22 
AnswerRe: SQL statement error: update record, why? Pin
Rajesh R Subramanian5-May-08 19:37
professionalRajesh R Subramanian5-May-08 19:37 
AnswerRe: SQL statement error: update record, why? Pin
toxcct5-May-08 21:51
toxcct5-May-08 21:51 
Questioncustom CSatusBar and double-buffering Pin
blamond5-May-08 15:02
blamond5-May-08 15:02 
AnswerRe: custom CSatusBar and double-buffering Pin
Rajkumar R5-May-08 21:51
Rajkumar R5-May-08 21:51 
GeneralRe: custom CSatusBar and double-buffering Pin
blamond6-May-08 8:46
blamond6-May-08 8:46 
QuestionHow to implement font size change feature of Office 2007? Pin
Rong Yao5-May-08 11:36
Rong Yao5-May-08 11:36 
AnswerRe: How to implement font size change feature of Office 2007? Pin
thammadi6-May-08 1:02
thammadi6-May-08 1:02 
QuestionDetect Print Preview without a DC [modified] Pin
bob169725-May-08 10:00
bob169725-May-08 10:00 
AnswerRe: Detect Print Preview without a DC [modified] Pin
Ozer Karaagac5-May-08 10:48
professionalOzer Karaagac5-May-08 10:48 
GeneralRe: Detect Print Preview without a DC Pin
bob169725-May-08 10:59
bob169725-May-08 10:59 
GeneralRe: Detect Print Preview without a DC Pin
Ozer Karaagac5-May-08 11:12
professionalOzer Karaagac5-May-08 11:12 
GeneralRe: Detect Print Preview without a DC Pin
bob169725-May-08 11:26
bob169725-May-08 11:26 

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.