This is the mail archive of the 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

>> +  void field_unsigned (const char *fldname, ULONGEST value)
>> +  {
>> +    field_string (fldname, pulongest (value));
>> +  }


>> This is quite different from how other types are handled, e.g.

>> ui_out::field_int (const char *fldname, int value)
>> {
>>   int fldno;
>>   int width;
>>   ui_align align;

>>   verify_field (&fldno, &width, &align);

>>   do_field_int (fldno, width, align, fldname, value);
>> }

>> Is there a reason for not treating int and unsigned int in a similar way?

There just didn't seem to be a benefit, and the field_int approach is

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:

    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,

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.


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