Friday, August 14, 2009

Top things I miss when going from Eclipse JDT to Visual Studio C++

I recently dived into Visual Studio to do some C++ hacking after several months of doing mostly Java in Eclipse, and discovered a few items which I really miss.
  • Hot code replacement. This is really addictive in Eclipse: I set a breakpoint in a function, edit the code around it. After saving, the code in the debugged JVM is replaced and PC is reset to the start of the function. The other day I got annoyed when this didn't work (I changed the class' external signature), and I actually had to restart the debug session. Oh no!
  • Drop-to-frame. I can at any time reset the execution state to a frame further down on the stack and rerun from there.
  • Automatic code formatting. In Eclipse I have function "format entire source file on save" switched on, basically letting the editor do all the formatting for me. It even does line-wrapping inside comments, something I find very handy. In Visual Studio I have to manually indent each line (well, the indentation level is given automatically), but things like line-wrapping I have to do manually.
  • Incremental background compilation. I can sit several seconds waiting for the code to build before I realize that I need to start the build manually. (You also have to save your code before you can get any sort of feedback from the compiler.)
  • The "open type" and "open resource" commands. "Open type" allows me to interactively search for a class and jump to it. Visual Studio has a similar search, but I often get multiple matches and need to think about which match I'm actually interested in. "Open resource" does the same thing, but searches for files in the workspace. Visual Studio only gives me the regular Open File dialog, which is useless since I first need to locate the directory the file is in.
  • Red squiggles for errors. Compilation errors are indicated as a tiny line in the margin, instead of a red squiggle in the code.
  • The Emacs-bindings in Visual Studio are much crappier than in Eclipse. The most annoying part is that TAB doesn't indent an empty line, so you have to start your line at column zero, and not until you've written at least one character can you indent the line. (The Emacs-bindings in Eclipse aren't perfect either, I especially miss the kill-ring).
I realize that several of these issues are very difficult to get right in a C++ IDE (hot code replacement and drop-to-frame, for example), or completely subjective (I don't really expect Microsoft to spend a lot of time getting Emacs-binding completely right; I'm actually very happy that there are Emacs bindings at all).

2 comments:

Carlos said...

Visual C++ has hot code replacement (at least for native code, it seems that it doesn't work for managed code). Also, you can move the execution pointer to be beginning of the function (or any other location).

JesperE said...

What requirements does hot code replacement have for Visual Studio? It doesn't work out-of-the-box for me at least.

Just moving the execution pointer isn't enough. You need to restore the machine state, which I'm pretty sure Visual Studio can't do. (JDT can't do it all the time of course, but surprisingly often.)