This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: [PATCH 3/3] Introduce field_unsigned


Hello Tom,

> In the end all the existing do_field_int methods actually just end up in their
> respective do_field_string methods anyway.  E.g., mi-out.c:
> 
>     void
>     mi_ui_out::do_field_int (int fldno, int width, ui_align alignment,
>                              const char *fldname, int value)
>     {
>       char buffer[20];	/* FIXME: how many chars long a %d can become? */
> 
>       xsnprintf (buffer, sizeof (buffer), "%d", value);
>       do_field_string (fldno, width, alignment, fldname, buffer,
>                        ui_out_style_kind::DEFAULT);
>     }
> 
> Here the new approach is actually a bit better because pulongest doesn't have this
> FIXME.  Perhaps we should instead switch field_int to take a LONGEST and follow
> the approach used in this new patch.

If subclasses don't need to know that the field was originally an integer or a float,
all of ui_out can be reduced to outputting strings and sub-classes need only provide
that one member function for all field types.

I don't have any preference one way or another, I was mainly commenting on the
apparent discrepancy how similar field types are handled.

Markus.

Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Gary Kershaw
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]