This is the mail archive of the
mailing list for the GDB project.
Re: [RFA] print arrays with indexes
On Thu, Sep 22, 2005 at 09:46:22AM -0700, Joel Brobecker wrote:
> > This sounds good to me too. Perhaps a compromise between what Eli
> > suggested and what you have been suggesting would work. How about
> > we implement a on/off knob for now. Later on, if we understand better
> > in which direction to use the threshold, then we can enhance the knob
> > to include "auto", and then have a second knob.
> > As long as we cross-reference each setting in the help text, I think
> > users won't be confused.
> No objection to the above, so far... Fingers crossed.
> Would you know, it just occured to me that the above is what my last
> patch actually implemented :). Assuming this intermediate approach is
> ok, I'm resubmitting that patch again.
> Note that the patch was first submitted in:
This looks OK to me, with documentation and tests. Minor comments:
- Reading the diff it's apparent that there is some space vs tabs
confusion in the Ada changes. I prefer tabs, but not violently so;
however, I mostly prefer that code match its surroundings. Otherwise
indentation in diffs looks very odd.
> /* Called by various <lang>_val_print routines to print elements of an
> array in the form "<elem1>, <elem2>, <elem3>, ...".
> + Some languages such as Ada allow the user to specify arrays where
> + the index of the first element is not zero. REAL_INDEX_OFFSET is
> + the user-level index of the first element of the array. For many
> + languages such as C or C++, it is always zero.
Ada is by no means the only language with this feature - namely,
Fortran. Can't you compute this value from the array type, instead
of passing it in from Ada-specific code? I couldn't see any obvious
reasons why not.
> +/* Assuming TYPE is a simple, non-empty array type, compute the lower
> + bound and the array index type. Save the low bound into LOW_BOUND
> + if not NULL. Save the index type in INDEX_TYPE if not NULL.
> + Return 1 if the operation was successful. Return zero otherwise,
> + in which case the value of LOW_BOUND and INDEX_TYPE is undefined. */
s/undefined/unmodified/, since you rely on it below.