[Debugging] Viewing variables in binary

Started by
2 comments, last by Trandafira 15 years, 9 months ago
Hey, so I've been doing alot of binary math lately in code and it gets annoying having to look at HEX and DEC numbers. I was wondering if anybody knows a way to display variables when debugging in visual studio ('05/'08) in binary. I can't seem to find anything in VS except the command debug.SetRadix(..) which only takes 10 or 16 as valid input. Maybe an add-in adds this functionality? If you've found something that does, please let me know :) Thanks Jonathan
Advertisement
I suppose you could create a dummy integer wrapper structure, include it in your autoexp.dat and write a debug presentation DLL which prints it in binary. Then add a watchpoint which casts the integer you want to display to this type.

Okay, not remotely practical but that's honestly the only way I can think of. It's a nice trick for fixed point classes and the like though. Personally I keep a binary-capable calculator handy instead, plus interpreting hex numbers doesn't take as much mental effort as it once used to.

Oh and don't forget that you can add a ",x" suffix to watchpoints to display individual variables in hexadecimal.
Personally when I was doing a lot with binary, hexadecimal became basically the same thing, it was maybe a .13 second delay between seeing the hexadecimal and knowing the binary. Actually it was much easier when working with large numbers to use hexadecimal representations
Cheers for the responses guys.

@Portmanteau: You make a valid point and I too am getting used to Hex.

@implicit: Hmm.. I might get the binary calc out as well.

This topic is closed to new replies.

Advertisement