This is the mail archive of the gcc-patches@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]

Re: C++ PATCH to implement initializer lists proposal (n2672)


+ ctor_to_list (tree ctor)
+ {
+   tree list = NULL_TREE;
+   tree *p = &list;
+   unsigned ix;
+   constructor_elt *ce;
+ 
+   for (ix = 0;
+        VEC_iterate (constructor_elt, CONSTRUCTOR_ELTS (ctor), ix, ce);
+        ++ix)
+     {
+       *p = build_tree_list (ce->index, ce->value);
+       p = &TREE_CHAIN (*p);
+     }
+ 
+   return list;

The canonical idiom would be to use FOR_EACH_CONSTRUCTOR_ELT here.

-- 
Eric Botcazou


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