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++] RFC: partial C99 designated-initializers support


Richard Henderson wrote:
On Fri, Oct 22, 2004 at 11:47:49PM +0200, Bernardo Innocenti wrote:

Bootstrapped and not tested as this will have to wait for
4.1 anyway.


It definitely doesn't work.  I'd written all of the parsing bits
once, until I stumbled upon the fact that the front end doesn't
even support the gnu extension properly -- it doesn't support
having the fields specified out of order.  Which is basically
the whole point.

Out-of-order initializers are checked for in process_init_constructor(), with a sorry("non-trivial labeled initializers"). Would that be easy to fix? And would it be welcome?

This shortcoming makes the syntax much less useful, but not completely
useless.  You can still use it to force each initializer to match
its intended structure field.

It's also a readability aid: sometimes C89 programs repeat the field
names in comments beside the value for the same reason.

--
 // Bernardo Innocenti - Develer S.r.l., R&D dept.
\X/  http://www.develer.com/


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