This article provides an overview of how to use the new Edit and Continue debugging feature in Visual C# 2005. The feature allows you to make changes to the code while an application is being debugged and apply those code changes without having to close, rebuild, and run the application again.
This feature has been around since VS.NET, I believe, and it works with C/C++ as well as managed code.
Wasn’t edit-and-continue ditched completely for all languages in VS.NET and VS2003 because of time constraints? I know I used it in VC++ 6.0 – pretty nifty feature even though things can get borked fast.
The JavaVM uses a similar pattern called hotfix. It’s possible to change bodies of methods but fails in changing method signatures, added interfaces, etc.
How does Visual C# handle those problems? Is it possible to change the declaring structure of the code or does it simply replace the method bodies like (Sun) JavaVM do?
You could do this in MSVC++ 6 years ago. It seems quite nifty and it puts a smile on your face when you first use it, but I’ve never really found it very useful to be honest. When you’re debugging a function, you note what the input is and diagnose what the error in the function was based on the output. If you start changing the function during execution, you’re just adding more complications to the debug process. I’m sure it’s useful in some rare cases, but it is not an essential tool or a killer feature in my opinion.
It has to be something really wrong the way you compile because i just tested the code you gave above and its not causing a divide by zero error for me.
Can you elaborate more on which compile time flags you are using and which version of Visual C?
Also just as a side note, Visual C is known as the best compiler for x86 architecture. It is known to generate the most optimized code for x86. Way better than gcc and even better then intel’s C compiler. So please first be informed and then make some stupid comments.
One more thing, MSDN clearly list if something is Microsoft specific or C++ specific in their docs. Its your mistake if you don’t read docs. Sometime its necessary to add their own extension when standards are not sufficient. An example is Structured exception handling. C++ exception handling sucks as compared to SEH. SEH lets you do much more and even has a _finally clause which is a very decent way to perform cleanup in your function. Standard C++ lack this feature because stroustrup feels its not important but indeed its god-send for programmers. Stroustroup should have listened. MS did the right thing here.
but in terms of standards compliance they generally fall short.
What’s more important: performance or correctness?
Performance.
Any person who knows some Lisp dialect (Common Lisp, Scheme, etc…) will laugh at the limitations of this “edit & continue” feature… lol.