|
akira32 wrote: Add/Remove operation is impossible, becuase the code element CDialogCommon is read only
The message itself it is clear that you cannot added new handler because the file is read only. So just take the DialogCommon.h and CDialogCommon.cpp and remove the readonly attribute
|
|
|
|
|
Hello everyone,
I am confused what is the function of the 4 assembly instructions? I posted the 4 assembly instructions and related whole source code/assembly code below.
Any ideas?
00BA13CC lea edi,[ebp-0C0h]
00BA13D2 mov ecx,30h
00BA13D7 mov eax,0CCCCCCCCh
00BA13DC rep stos dword ptr es:[edi]
int sumExample (int a, int b)
{
00BA13C0 push ebp
00BA13C1 mov ebp,esp
00BA13C3 sub esp,0C0h
00BA13C9 push ebx
00BA13CA push esi
00BA13CB push edi
00BA13CC lea edi,[ebp-0C0h]
00BA13D2 mov ecx,30h
00BA13D7 mov eax,0CCCCCCCCh
00BA13DC rep stos dword ptr es:[edi]
return a + b;
00BA13DE mov eax,dword ptr [a]
00BA13E1 add eax,dword ptr [b]
}
#include <iostream>
using namespace std;
int sumExample (int a, int b)
{
return a + b;
}
int main()
{
int c = sumExample (100, 200);
cout << c << endl;
return 0;
}
thanks in advance,
George
|
|
|
|
|
George_George wrote: Any ideas?
I think you are running a debug version. In the release version it wont come.
The purpose of that instructions is to initialize all the memory location of from ebp-0C0h to edp with value 0CCCCCCCCh. The address "ebp - 0C0h" to ebp is the stack range of the function sumExample().
|
|
|
|
|
Thanks Naveen,
1.
You are correct, I am using debug version. So, only debug version will initialize stack used in current function to zero, and release version will not (I have tried in my sample, it is yes. Here I want to ask for a general answer.)
2.
How do you calculate the memory used will be 0x0C0 bytes?
regards,
George
|
|
|
|
|
George_George wrote: So, only debug version will initialize stack used in current function to zero
No to 0 but to 0x0CCCCCCCC
George_George wrote: How do you calculate the memory used will be 0x0C0 bytes?
Compiler does this at compile time itself. It calculate this value by adding the size of variables, flags to push etc.
|
|
|
|
|
Cool, nave!
From the code I posted in my 1st post, do you have any ideas why the stack used is 30h? I am very confused why the address begins with ebp-0C0h?
regards,
George
|
|
|
|
|
George_George wrote: do you have any ideas why the stack used is 30h?
Stack size is actually C0h. An that 30h is a counter ( C0h/4 = 30h ). I dont know why the stack size became C0h in your case. May be the compiler allocates atleast that much stack for a function and I have found it depends on the compiler version.
|
|
|
|
|
Thanks nave,
I found why I am confused by reading your reply, the counter is in the basis of 4-byte, not 1-byte, correct?
regards,
George
|
|
|
|
|
4 is the sizeof doubleword and the count is the count of doublewords as it uses "store string instruction" (rep stosd).[^]. if it uses rep stosb[^] it would be 1 byte
|
|
|
|
|
1.
Cool, Rajkumar. I think the 4 assembly instruction is doing stack initialization work for the stack space used for foo function, correct?
2.
But from the 4 assembly instruction, how do you know it ends from address ebp-0C0h and is 30 * 4 bytes length?
regards,
George
|
|
|
|
|
George_George wrote: I think the 4 assembly instruction is doing stack initialization work for the stack space used for foo function, correct?
i think so (i admit), to facilitate ease debug VC++ compiler fills stack variables with 0cch and heap with 0cdh(if my knowledge is correct ).
George_George wrote: But from the 4 assembly instruction, how do you know it ends from address ebp-0C0h and is 30 * 4 bytes length?
as naveen said, it is the stack frame size calculated by compiler, refer fixed-allocation-size
in [Prolog and Epilog^] and [Stack Allocation^] for paramters considered for that.
modified on Monday, July 21, 2008 9:28 AM
|
|
|
|
|
Thanks Rajkumar,
1.
Rajkumar R wrote: it is the stack frame size calculated by compiler, refer fixed-allocation-size
Do you mean stack will be initialized just according to how much data will be used actually? Or no matter how much data will be used, a fixed size will be initialized?
2.
My confusion is, from the assembly code I posted, more stack space than I acually used is initialized. Any comments?
regards,
George
|
|
|
|
|
Hi George,
I believe the whole idea is twofold:
1. to initialize your function's local variables to a strange value,
increasing the probability that you will discover potential "variable value used before
being set" mistakes. Your function does not have local variabled, so this does not apply here.
2. allocate more stack space than needed, and fill it with something that springs out
in a hex dump, so you can easily recognize the stack frames of each of your functions.
Both of these reasons don't hold true for release code, since they cost both CPU cycles
and stack space.
|
|
|
|
|
Thanks Luc,
Luc Pattyn wrote: allocate more stack space than needed
It is ok. But how to calculate the actual stack space used? For example, in my sample?
regards,
George
|
|
|
|
|
The compiler is responsible for stack allocation. It knows what it wants
to store on stack, and it can round it up to whatever number it chooses,
as long as it emits correct code (e.g. it should not initialize more memory
than it has allocated for each and every function).
|
|
|
|
|
Thanks Luc,
How does compiler calculate the size of the stack in my sample, I do not know why the size is 30h in my sample. It is much more than actually used?
regards,
George
|
|
|
|
|
Hi i am new to this forum can u please suggest me or refer me to apt links for changing the color for the menu other than the default one
Harish Akuthota
|
|
|
|
|
Take a look on menu section[^] of the site. You may find lots of articles that have usefull info for you.
Regards.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
might be you have to find way to subclass the MENU class!.. you then paint the MENU with your choice of color
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You/xml>
|
|
|
|
|
Actually i want to read each pixel of image, it may be of any type. For exa take .ppm image file, which contains less information. But i don`t know the exact structure of header or pixel. I am interested in C/C++ only. Plz tell me something about how to open image headers or pixels in C/C++? or tell me any sitename where i can found all information.
http://nnhamane.googlepages.com/
|
|
|
|
|
Quote: "or tell me any sitename where i can found all information. " //Damm I hate the restrictions on the work... I am missing all buttons :S
Try with the CodeProject searching about DDB (Device Dependant Bitmap), DIB (Device Independant Bitmaps), BITMAPINFOHEADER, DDB to DIB... and restricting the search with NOT MFC. You should find usefull information.
Regards.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
Hi you all,
I am trying to build a bit of software to generate a web picture book. I know that there are a lot of programs around to do just that, but I want to write my own HTML that fits into existing websites. The HTML is no problem, but I need to be able to load images from different formats (.jpg, .bmp, .tiff, etc) and generate .jpg images from them for both a thumbnail and the actual image to be shown. Does anyone have any suggestions for the way to
a: load the images
b: resize them so that a relatively neat image will result
c: save them as .jpg images?
Thanks a lot in advance.
William
|
|
|
|
|
|
Thanks a lot. It does what I would like to do!
There is only one thing though: I do not see any function to save the altered image (preferably as a .jpg file) Do you have any information on how to do this?
Thanks a lot!
William
|
|
|
|
|
Have a look at GDI+ [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|