This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: PATCH RFA: -Wc++-compat warning about ++/-- with enum value
- From: Ian Lance Taylor <iant at google dot com>
- To: Steve Kargl <sgk at troutmask dot apl dot washington dot edu>
- Cc: gcc-patches at gcc dot gnu dot org, fortran at gcc dot gnu dot org
- Date: Thu, 14 May 2009 09:57:40 -0700
- Subject: Re: PATCH RFA: -Wc++-compat warning about ++/-- with enum value
- References: <m3k54jn0ys.fsf@google.com> <20090514163808.GA22680@troutmask.apl.washington.edu>
Steve Kargl <sgk@troutmask.apl.washington.edu> writes:
> On Thu, May 14, 2009 at 08:44:27AM -0700, Ian Lance Taylor wrote:
>>
>> Bootstrapped and tested on i686-pc-linux-gnu. OK for mainline?
>>
>
> Can you please explain why there is a need to
> make the code compilable with a C++ compiler?
> Do I need to now learn C++, so I don't run afoul
> of your effort?
The goal of writing gcc such that it can be compiled with a C++ compiler
has been present for a long time. It is listed here under Portability:
http://gcc.gnu.org/codingconventions.html
I am working on a long-term project to write gcc in C++:
http://gcc.gnu.org/wiki/gcc-in-cxx
This has been discussed at some length on the gcc@ mailing list. Some
people are in favor, some are opposed. Nobody has expressed strong
opposition to the intermediate goal of writing gcc in the common subset
of C and C++ (I discount some mutterings and grumblings). This patch is
part of that intermediate goal.
You do not need to learn C++ currently, as the -Wc++-compat warning will
prevent you from writing code which is not in the common subset of C and
C++. In the future, if gcc does switch to C++, you may need to learn
some C++ (the fortran frontend can remain in the common C/C++ subset if
the fortran maintainers prefer that). Although C++ is a complex
language, the complexity is largely in the interactions of different
aspects which are in themselves reasonably straightforward. There is no
reason to think that gcc will rely on that complexity. I expect that
the parts of C++ which gcc maintainers will need to understand will be
simpler than, say, understanding gcc/vec.h.
Ian