Watch Or Query The Return Value Of A Function

  • Thread starter Thread starter Gary Brown
  • Start date Start date
G

Gary Brown

Hi,

In the good old days of Borland C++ the debugger would show
a function's return value when single stepping or at a break at
the closing '}'. Is there a similar capability in VS 2005?

Thanks,
Gary
 
You can put the method call in the watch window.
Debug->Windows->Watch->Watch1
The usual semi-colon it not applicable though.
 
Hi Simon,

Just beware that the debugger will execute the method and no breakpoints will
be hit. Doing so doesn't let you see the return value of the method at which
the debugger is currently stopped at a break point and it's possible that
non-deterministic methods will return different results.

The only safe way, AFAIK, is to let the method return by stepping out
(Shift+F11) and checking the variable to which the method return value was
assigned.

If there is no variable then I believe you're out of luck. This is one aspect
of debugging that I wish I had as well, but I don't think it exists in VS.
Maybe there is some way using a memory window or the registers window, but
that would be a bit convoluted if either of those does work.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top