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: Patch committed: Don't use designated initializers with C++


Jakub Jelinek <jakub@redhat.com> writes:

> On Tue, Jun 09, 2009 at 07:02:56PM -0700, Ian Lance Taylor wrote:
>> This patch changes system.h to not define HAVE_DESIGNATED_INITIALIZERS
>> when compiling with C++.  It then changes optabs.c to only use
>> designated initializers when HAVE_DESIGNATED_INITIALIZERS is defined.
>
> Better would be to add support for designated initializers into C++ FE.

That is problematic in the general case, which is why they are not in
the C++ language.  It's not merely a gratuitous difference with C.  The
"C++ way" to implement this would be to write a default constructor for
struct optab_d.

It's not like anything loops over all the insns, so we could easily
address this specific issue by changing CODE_FOR_nothing to have the
value 0.  This would make a few generated const arrays one element
larger, but I think it would pay back by changing a bunch of tests in
the compiler to test against 0 instead of a constant.

Ian


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