This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC 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]

CONSTRUCTOR Confusion about the gccinternals document.


The CONSTRUCTOR section of the gccint manual contains this:

"These nodes represent the brace-enclosed initializers for a structure or
array. The first operand is reserved for use by the back end. The second
operand is a TREE_LIST. If the TREE_TYPE of the CONSTRUCTOR is a
RECORD_TYPE or UNION_TYPE, then the TREE_PURPOSE of each node in the
TREE_LIST will be a FIELD_DECL and the TREE_VALUE of each node will be the
expression used to initialize that field. You should not depend on the
fields appearing in any particular order, nor should you assume that all
fields will be represented. Unrepresented fields may be assigned any
value.

If the TREE_TYPE of the CONSTRUCTOR is an ARRAY_TYPE, then the
TREE_PURPOSE of each element in the TREE_LIST will be an INTEGER_CST. This
constant indicates which element of the array (indexed from zero) is being
assigned to; again, the TREE_VALUE is the corresponding initializer. If
the TREE_PURPOSE is NULL_TREE, then the initializer is for the next
available array element.

Conceptually, before any initialization is done, the entire area of
storage is initialized to zero."


I'm confused by the statements "Unrepresented fields may be assigned any
value." and "Conceptually, before any initialization is done, the entire
area of storage is initialized to zero."

These seem contradictory.  Perhaps only the array case should be
initialized to zero?  If not, should the ""Unrepresented fields may be
assigned any value." statement be modified?

-Chris

-- 
http://llvm.cs.uiuc.edu/
http://www.nondot.org/~sabre/Projects/


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