Click here to Skip to main content
15,893,814 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How to detect illegal memory consuming? Pin
Roger Stoltz23-Aug-09 22:10
Roger Stoltz23-Aug-09 22:10 
AnswerRe: How to detect illegal memory consuming? Pin
Behzad Ebrahimi25-Aug-09 20:24
Behzad Ebrahimi25-Aug-09 20:24 
Questioninsert bitmap on SDI Pin
Amin.Abdi22-Aug-09 21:15
Amin.Abdi22-Aug-09 21:15 
AnswerRe: insert bitmap on SDI Pin
Hamid_RT22-Aug-09 22:18
Hamid_RT22-Aug-09 22:18 
GeneralRe: insert bitmap on SDI Pin
Amin.Abdi22-Aug-09 22:39
Amin.Abdi22-Aug-09 22:39 
GeneralRe: insert bitmap on SDI Pin
Iain Clarke, Warrior Programmer23-Aug-09 4:23
Iain Clarke, Warrior Programmer23-Aug-09 4:23 
GeneralRe: insert bitmap on SDI Pin
Amin.Abdi23-Aug-09 4:34
Amin.Abdi23-Aug-09 4:34 
GeneralRe: insert bitmap on SDI Pin
Hamid_RT27-Aug-09 5:21
Hamid_RT27-Aug-09 5:21 
QuestionFunction overloading.. Pin
kumar sanghvi22-Aug-09 3:28
kumar sanghvi22-Aug-09 3:28 
AnswerRe: Function overloading.. Pin
Rajesh R Subramanian22-Aug-09 4:35
professionalRajesh R Subramanian22-Aug-09 4:35 
AnswerRe: Function overloading.. Pin
Stuart Dootson22-Aug-09 6:46
professionalStuart Dootson22-Aug-09 6:46 
Questionpointer Pin
kumar sanghvi21-Aug-09 23:56
kumar sanghvi21-Aug-09 23:56 
AnswerRe: pointer [modified] Pin
Rajesh R Subramanian22-Aug-09 0:05
professionalRajesh R Subramanian22-Aug-09 0:05 
GeneralRe: pointer Pin
kumar sanghvi22-Aug-09 0:21
kumar sanghvi22-Aug-09 0:21 
GeneralRe: pointer Pin
Rajesh R Subramanian22-Aug-09 2:10
professionalRajesh R Subramanian22-Aug-09 2:10 
GeneralRe: pointer Pin
harold aptroot22-Aug-09 9:04
harold aptroot22-Aug-09 9:04 
GeneralRe: pointer Pin
Rajesh R Subramanian22-Aug-09 19:05
professionalRajesh R Subramanian22-Aug-09 19:05 
AnswerRe: pointer Pin
Rajesh R Subramanian22-Aug-09 19:06
professionalRajesh R Subramanian22-Aug-09 19:06 
AnswerRe: pointer Pin
harold aptroot23-Aug-09 7:54
harold aptroot23-Aug-09 7:54 
kumar sanghvi wrote:
int* p; //declared pointer to int (statement does nothing)<br />
int w=10; //declares and initializes an int to 10, but it won't exist unless you use it<br />
p=&10; //this is an error, you probably meant p=&w?

p=&w would do, assuming p is used: give (if it didn't have one yet) w a place on the stack (previously it would probably reside in a register), and set p to that address (eg lea esi, dword ptr[esp+24]), but if the operations on p are simple enough (for the specific implementation, not every theoretically simple enough sequence of operations) to evaluate at compile time it may be optimized to something weird and/or scary.

But it's fine to think of them as being on the stack, the compiler will guarantee that this assumption is true whenever you make it (and if you don't make it, it doesn't matter). They're definitely not on the heap, if that's what you were wondering about.


notes: many simplifications and omissions were made to avoid writing a king-sized post, if you really want to know every little detail you could ask the same question on comp.lang.c++[^], they will be happy to tell you every pedantic little detail. And I don't guarantee that anything in this post was actually true, use the information at your own risk (etc etc)



GeneralRe: pointer Pin
Rajesh R Subramanian23-Aug-09 8:13
professionalRajesh R Subramanian23-Aug-09 8:13 
GeneralRe: pointer Pin
harold aptroot23-Aug-09 8:40
harold aptroot23-Aug-09 8:40 
QuestionHRESULT:0x8007007E Pin
MozhdehQeraati21-Aug-09 18:32
MozhdehQeraati21-Aug-09 18:32 
AnswerRe: HRESULT:0x8007007E Pin
Code-o-mat21-Aug-09 22:03
Code-o-mat21-Aug-09 22:03 
AnswerRe: HRESULT:0x8007007E Pin
Hristo-Bojilov22-Aug-09 6:02
Hristo-Bojilov22-Aug-09 6:02 
GeneralRe: HRESULT:0x8007007E Pin
MozhdehQeraati23-Aug-09 18:11
MozhdehQeraati23-Aug-09 18: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.