views:

81

answers:

1

I have type which is just a typedef-ed long which one I would like to display differently in a debugger. Is it possible to do so using autoexp.dat?

namespace MyNamespace
{
 typedef long DaysSinceItAllStarted;
}
A: 

I do not think that is possible for builtin types; I'm also not sure how that would benefit you: a long is a long, typedef-ed or not, you can represent it as a plain or hex number, but that's about it.

If you somehow want to incorporate the fact that a long variable means 'DaysSinceItAllStarted' in the debugger, choosing a good descriptive name for that variable is way better than trying to get the debugger to do nifty things, that other people reading your code can't even see.

If you use a struct/class however, you can get the debugger as verbose you want..

namespace MyNameSpace
{
  struct TimeSinceItAllStarted
  {
    unsigned long days;
    unsigned long hours;
  }
}

In autoexp.dat:

MyNameSpace::TimeSinceItAllStarted = DaysSinceStart=<days,u>, HoursInThatDay=<hours,u>

In watch window

+theStartOfAllThings   {DaysSinceStart=0, HoursInThatDay=0}
stijn
yeah, this is all great but the reality is - threre is a huge a library to maintain (thousands of classes), deadlines are short, half of the files are already checked out to someone else and I honestly would not dare to change 10000 of occurences of that existing typedef to my new type. What was I after is to simplify my life in a short term, until I learn code enough.
Steve
sorry to hear that; I tried several things in autoexp.dat, you rpobably tried as well, but I could not get to display a long as anything else but a long.. But i just thought of another thing you could try: when debuggng, set a breakpoint near where you want to see a variable's value, right-click and select 'when hit'. There you can print a custom message (ie 'DaysSinceItAllStarted = %value%) to the output window!
stijn