
View double* as array of double?
Quote:
> >I have a pointer (lets say to type double) the de{*filter*} correctly shows me
> >the value pointed to, but the de{*filter*} is unaware that it is merely the
> >first of many values in an array! (I'm viewing the guts of a container
> >type class)
> >How do I view the array of doubles instead of just the first one?
> >I can't find anything on this in the online help files.
> Isn't this normal behaviour, a pointer to char only shows the first
> byte as well.
> There are two work arounds, the first in the de{*filter*}, the second in
> code :
> double_var[0]
> double_var[1] up to
> double_var[n] show you all you want;
> In code :
> #define NBR_OF_DOUBLES 17
> int func(double * ptr) // actually an array
> {
> double arr[NBR_OF_DOUBLES];
> memcpy(arr, ptr, sizeof(arr));
> }
> Now the de{*filter*} can show you the values of all doubles in arr.
> Since a pointer is syntactically the same as an array, the de{*filter*}
> can't see the difference. So you have to show it, don't you?
I'm sorry, this still seems kinda weak from a debugging point of view...
(memcpy ?!)
Yes I know that a pointer to double is not *exactly* the same as an array
of double,
but its damn close, and is seems like such an obvious thing to want to view
(viewing the entire array, not just one at a time via *(ptr+n) syntax.)
I guess I'm just spoiled by Metrowerks de{*filter*} (Mac version, I can't
speak for their PC offerings), which offers a "Open Array Window" menu
command when an array or a pointer is the current selection.
--
Tim Gogolin
Software Engineer, Stat-Ease, Inc.