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]

Re: Using C++ in GCC is OK


On Mon, May 31, 2010 at 12:02 PM, Mark Mitchell <mark@codesourcery.com> wrote:
> Richard Guenther wrote:
>
> I think virtual functions are on the edge; quite useful, but do result
> in the compiler adding a pointer to data objects and in uninlinable
> indirect calls at run-time. ?Therefore, I would avoid them in the
> initial subset of C++ used in GCC.

In the current GCC source code, the additional data is already there in
forms of enum codes that we use to distinguish various trees or types.

To be clear, a virtual function should be used only when it is clear that there
are more than one kind of information to be accessed, and that access
requires dynamic resolution.  Otherwise, we should either use a simple
template or an enum.

> I am certainly a "C++ guy", and I feel that all these features have
> their place, but I think we should err on the side of using less of C++,
> rather than more. ?We have C code that works, and we have a group of
> developers comfortable in C. ?We lose if we break our code, and even
> more if alienate those developers.

There are good C++ coding standards out there, and I would be reluctant
to encourage a NIH-driven design as opposed to adapting existing ones
that have been given lot of considerations:

   http://www2.research.att.com/~bs/bs_faq2.html#coding-standard
   http://www2.research.att.com/~bs/JSF-AV-rules.pdf

certainly there are elements there that are use for us to consider.


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