From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jim Blandy To: Andrew Cagney Cc: gdb-patches@sources.redhat.com Subject: Re: [patch] clarify ``struct type . length'' Date: Wed, 05 Sep 2001 10:59:00 -0000 Message-id: References: <3B81A9BC.4010807@cygnus.com> X-SW-Source: 2001-09/msg00040.html Andrew Cagney 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.