|
Hello Everybody...
I had some confusion.
1.What are the basic diffence in building a program in Debug and Release in VC++ 6.0.
2.Is there any affect to the logic of the code in this two versions.
thanx in advance
birajendu
CyberG India
Delhi
India
|
|
|
|
|
|
the simpler you can do to see a difference is simply looking at the generated .exe files sizes.
in debug mode compilation, the file is more "heavy" because the compiler don't perform some optimizations, and the more important, it does insert some functions into the generated code to perform the debugging thing...
if you are able to use a breakpoint, a step by step debugging, etc, is thanks to these.
in release mode, the compiler tries to make the exe the more performant as possible... when you make a delivery version of a project, provide the release mode compiled version.
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VisualCalc 3.0]
|
|
|
|
|
Very basic answer:
In Debug you can set breakpoints and step through the code to see how each line is executed. The code size is bigger (all symbols are loaded for debugging) and it is also slower. All code in ASSERT() , macros (which is usually checking if everything oes OK) is executed, letting you point out where exactely a program crashes.
In Release, compiler optimisations are turned on, and the code is smaller and usually much quicker. If the program crashes, all you get is a messagebox notification, and it is more difficult, if not impossible, to find out what instruction crashed.
As the names suggest, debug compilation is for debugging purposes, and the release compilation is used for building software released to your users/customers/rest of the world.
~RaGE();
|
|
|
|
|
thanx....to all of you
birajendu
CyberG India
Delhi
India
|
|
|
|
|
One important point which is mentioned in various articles on code project (eg. Survive the Release Build - see first reply) but has not appeared in the replies to you is that the debug build tends to initialise local variable storage to 0 when a function is called, while with Relese builds, you gvet whatever the contents were.
As long as your warning level checks for "variables used before being assigned values", this should not be a problem.
|
|
|
|
|
thanx Norman,
ya i was confused only due to the local variable issue,which behaved differently in debug and release versions.I had gone thru the code project article also.
Now I feel somewhat comfortable in understanding these problems..
Thanx a lot...
birajendu
CyberG India
Delhi
India
|
|
|
|
|
... initialise local variable storage to 0
Not that I have noticed. In fact, Visual C++ 6.0 and .NET 2002 both set unassigned variables to something like 0xCDCDCDCD.
Also in Debug mofe, apart from the preprocessor variable _DEBUG being defined, changes are made to several system functions, including new and delete to help catch problems with memory allocation. Allocated blocks of memory have guard bands around them. All user-written functions have code added at the beginning and end to look for problems.
If you release a Debug build, beware - there is debugging information in the .EXE file, a wonderful opportunity for hackers. Makes life so much easier for people to disassemble your program. Try writing a program that WILL crash, and compile it both in Debug mode and in Releae mode. Run the Release version outside the Visual C++ environment, as if it was an ordinary program being run. When it crashes, the system will offer to help debug it. Accept the defaults offered, and you will find yourself back in Visual C++, wondering what on earth you are looking at. Do the same with the Debug build and you will see the difference.
Note that the checks for unassigned variables are not foolproof, unfortunately. I have sometimes have the Debug version work perfectly, and the Release version of the same code crashes due to unasigned variables not being detected.
Shraddhan
|
|
|
|
|
i have to send messages between two applications. the communication should be synchronised. i.e the sender should wait till it gets a acknowledgement from the receiver. how can i proceed. please help..
|
|
|
|
|
|
To complete Mr Dunn' post, this is a code snippet that may help you. It is an answer to one of my questions on this forum, one or two years ago, where I tried to exchange CStrings between two apps. (Thanks to jhwurmbach and peterchen).
Another option is a WM_COPYDATA message. You will receive a copy of the data (but this is valid only while the message is processed, so create your own copy on the client side)
for a CString:
Sender:
CString myString = ...
COPYDATASTRUCT cds;
cds.dwData = 0;
cds.cbSize = (myString.GetLength()+1) * sizeof(TCHAR);
cds.lpData = (LPCTSTR) myString;
::SendMessage(hwndReceiver, WM_COPYDATA, (WPARAM) hwndSender, (LPARAM) &cds);
Receiver - WM_COPYDATA handler:
HWND sender = (HWND) wParam;
COPYDATASTRUCT & cds = *(COPYDATASTRUCT *)cds.lpData;
CString receivedString = (LPCTSTR) cds.lpData;
Note: this does not handle passing from UNICODE app to ASCII/MBCS app (or vice versa) correctly
~RaGE();
|
|
|
|
|
|
Hello all,
using a console application i want to print a webpage(html/htm) saved on my disk.How can i do that? i have done a lot of work on it & i am unable to find the solution.I am wondering whether there is a solution to it in vc++.Shellexecute definitely doesn't print in this case.Kindly Help.
Regards,
Ankush
Ankush Mehta
|
|
|
|
|
Hello all,
I have .eml (Internet E-Mail Message) Type of file on my disk. I want to print it.Do i need to automate outlook express(How??) or is there any other better way..
Regards,
Ankush
Ankush Mehta
|
|
|
|
|
Is there any way to manually define resource id without conflict with others?
|
|
|
|
|
|
Sig improved! new one is nice
|
|
|
|
|
|
Sig can be made still smaller.
-Prakash
|
|
|
|
|
If you mean code to return an ID that isn't used you could use the EnumChildWindows and GetWindowLong with the GWL_ID parameter to conjure one up. If you're not talking about making one at runtime "Owner drawn" has a point - although generally the dialog editor will make sure you get a unique one.
Steve
|
|
|
|
|
I have a macro that renumber resources in resource.h sequentially. Depending of what did you mean with your question, it might help.
Igor Green
http://www.grigsoft.com/ - files and folders comparison tools
|
|
|
|
|
Dear members
Plz suggest me some code to colourize the scrollBars of a MDI application
Thanks
rohini sharma
|
|
|
|
|
|
Ahh, colour spelt with a "u". As an Australian programmer I always have to "misspell" colour (when wearing my programming hat).
Steve
|
|
|
|
|
See WM_CTLCOLORSCROLLBAR (for scrollbar controls only).
Also see Flat Scroll Bars - In particular the FlatSB_SetScrollProp function.
Steve
|
|
|
|