|
The second one has a more clearer control over all the possibilities of the execution path whereas first one is easier to comprehend and faster as well cause it will straight away exit the function when certain condition(s) are met.
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
Totally agree. A function shall have a single (!) point of exit. This pays enormously when debugging.
If you structure your code well enough and stay away from 500-line functions, then there is no problem with that.
Bernd
|
|
|
|
|
Hi!
berndg wrote:
Totally agree
With which version do you agree? None of them has a single point of exit. Both of them perform exactly the same conditional tests in exactly the same order.
--
Dad, how strange it is that the pig can speak. *thoughtful pause* It must have lost its "oink". (my 3-year old daughter Moa, while watching Babe)
Human beings, who are almost unique in having the ability to learn from the experience of others, are also remarkable for their apparent disinclination to do so. (Douglas Adams)
|
|
|
|
|
Oops! I overlooked that one, haven'd scrolled down far enough. In that case both are evil, because the paradigm holds: each function shall have one exit point.
I find the most natural way of writing this is like so:
if (a) {
...
} else if (b) {
...
} else {
...
}
Bernd
|
|
|
|
|
The easiest way would be to compare the generated assembly code, if they are different after the optimizer (disabled in debug) has done its work.
Who is 'General Failure'? And why is he reading my harddisk?!?
|
|
|
|
|
Hello y'all
In my application, I have tons of messages in the debug window that say
First-chance exception in BurCalc.exe (KERNEL32.DLL): 0xC0000005: Access Violation.
Can anybody give me a hind how I have to check out this issue. I'm regularely using CString and CMaps... is this a source of troubles? But I'm using it also in other applications without any problems...
Any help?
Regards,
Daniel
|
|
|
|
|
Pointer problem?
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
If you are using VC6,
goto the debug menu, select the Exceptions option.
Find Access Violation in the list. Click Stop Always.
Now when the violation occurs, the debugger will stop in the offending code. This should help you track down the problem.
Michael
But you know when the truth is told,
That you can get what you want or you can just get old,
Your're going to kick off before you even get halfway through.
When will you realise... Vienna waits for you? - "The Stranger," Billy Joel
|
|
|
|
|
Michael P Butler wrote:
If you are using VC6,
goto the debug menu, select the Exceptions option.
Find Access Violation in the list. Click Stop Always.
Hi, i would also like to enable this feature, however, i cant find the "debug" menu or the "Exceptions" item you mention.
Could you be more specific on how to enable this feature?
Thanks!
|
|
|
|
|
Ernesto D. wrote:
Could you be more specific on how to enable this feature?
Sorry, the debug menu doesn't usual appear unless you are debugging your app.
If you run your app by press F11, the app will stop at the first line. You should then see your debug menu. Set the option and hit F5 and you can start to find the problem.
Hope this helps,
Michael
But you know when the truth is told,
That you can get what you want or you can just get old,
Your're going to kick off before you even get halfway through.
When will you realise... Vienna waits for you? - "The Stranger," Billy Joel
|
|
|
|
|
|
Im looking for a good tutorial on importing text files, rearraging the data, then writing it to a new file. Anyone know a good one???
thanks
|
|
|
|
|
Use CFile objects in MFC to read character-data from the text file. Save this data into an array/matrix of characters. Then do your rearranging, whatever that is. After that, write it into a new file using a new CFile object again.
See the documentation of CFile for examples.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
i need to download the msdn
but i cant find it
where i get exact downloadable link of msdn library
pls help
thanx
regards
rajesh
|
|
|
|
|
I dont know why would any one spend hell lot of time downloading the msdn when you can view it online, as far as i know there is no option to download MSDN, Try getting hold of MSDN 2004 cds.
I Touched Osama Bin Ladens Bushy Beard
|
|
|
|
|
|
Is there any way to do that? Tried to PlaySound() -method, did not seem to work. Thank you.
|
|
|
|
|
I already found the way in Multimedia section, sorry for bothering.
|
|
|
|
|
Hi All,
I was trying to detect a File Open/save Dialog box event of any generic windows application using windows hook. I got a very good suggestion from this forum of installing a WH_CBT hook and check the classname of every window created , if it matches the FileOpen Dialog's classname do my stuff.
This actually works very nicely but now I have a slightly different problem.
I need to use WH_GETMESSAGE hook for mouse/keyboard events detection as well. So I am trying to get away with installing just a WH_GETMESSAGE for HCBT_ACTIVATE event. I actually do get this event just like I get one if I had installed a WH_CBT hook. However I do not get a pointer to the HWND like a get from the wParam parameter if I had installed a WH_CBT.
I checked both the ((Message)lParam)->wParam as well as wParam but I do not get the valid HWND pointer.
Need help. Thanks in advance.
Regards,
Zahid
Regards,
Zahid
|
|
|
|
|
How can debug a dll in a runtime?
I have a command line program which uses a dll and i would like to debug the dll during run-time. how can i do that.
Shenthil
|
|
|
|
|
In your DLL project
Specify your Debug - Executable for debug session. (the executable which uses the DLL)
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
Alternatively, in the EXE project, go to Project > Settings > Debug tab > Additional DLLs category. Add any DLLs to be debugged along with the project here.
A third way, IIRC, is to add both projects to the same workspace.
|
|
|
|
|
|
Thanks. I am working on it. Also, do u know how to turn off disassemble while debugging.
|
|
|
|
|
Hi
I am trying to use the ATL class 'CRegKey'. I want to use the member function
'EnumKey()' which is described at the website.
If i look into the header file myself, that member function and some others aren't included.
Am i working with an old version of the ATLBASE.H? Can i upgrade this file and get all features of CRegKey?
I have Windows2000, Visual Studio 6.
Any ideas?
Greetings
Jens
|
|
|
|