Re: [patch] static_kind -> bit0, bit1 [Re: [gdb] Fortran dynamic arrays]

Tom Tromey
2008-09-26T23:04:15Z

>>>>> "Joel" == Joel Brobecker <brobecker@adacore.com> writes:

[ type rearrangements ]

Joel> As you suggest, this is easily achievable in C as well by using
Joel> unions, with the one difference is that Ada does some access
Joel> check and makes sure that we access fields that are consistent
Joel> with the discriminant (field named "Kind" in the example above).

GCC accomplishes this using checking in the accessor macros.
For the most part this works well -- it certainly catches bugs.

Joel> I think that this would help clarify the whole structure, and tell us
Joel> what is and what is not used for each kind of type. But I am not sure
Joel> of the drawbacks... For sure this would be a pretty significant change
Joel> througout GDB, but maybe an interesting one.

Joel> (that was my windy way of saying: I think I agree)

I think it would be a good idea provided that there's some data
indicating that the space savings is worthwhile. I'm not sure what
would qualify here.

Tom