[patch] clarify ``struct type . length''

Jim Blandy jimb@zwingli.cygnus.com
Wed Sep 5 10:59:00 GMT 2001


Andrew Cagney <ac131313@cygnus.com> writes:
> I've checked the attatched in as an obvious fix.  It clarifies the 
> length field of the ``struct type''.

> !     /* Length of storage for a value of this type.  This is of length
> !        of the type as defined by the debug info and not the length of
> !        the value that resides within the type.  For instance, an
> !        i386-ext floating-point value only occupies 80 bits of what is
> !        typically a 12 byte `long double'.  Various places pass this to

I'm not sure I agree it's a clarification.  :)

type->length is simply what "sizeof()" would return.  Making a
distinction between the size "as defined by the debug info" vs. "the
value that resides within a type" is a bit murky.

(To begin with, values don't "reside in" types; they "have" types.
They reside in blocks of memory, or registers.)

I suggest:

Length of storage for a value of this type.  This is what sizeof
(type) would return; you use it for address arithmetic, memory reads
and writes, allocating buffers to hold the value in GDB, etc.  This
size may include padding: for example, an i386-ext floating-point
value is only ten bytes long, but most compilers assign it a size of
twelve bytes, so that arrays of floats are aligned better.



More information about the Gdb-patches mailing list