Using C++ in GCC is OK

Mark Mitchell mark@codesourcery.com
Mon May 31 19:00:00 GMT 2010


Andi Kleen 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
> 
> Is that still true given profile feedback and the recent
> devirtualization work? I would assume the common case
> to get inlined then anyways.

I don't think we have enough evidence to make that a safe assumption.  I
would prefer to be conservative in making this transition; we have a
consensus that we want to use C++, but quite a few people who are
concerned about what that means in practice, and so I think we should
make the transition slowly and carefully.

Don't get me wrong; I think virtual functions are very useful.  The
"target hooks" and "language hooks" we have are essentially "poor man's"
virtual functions, and we could naturally (and mechanically) convert
them to actual virtual functions.  That's why I think virtual functions
are on the edge.  If the consensus is that it's OK to use them now
that's OK by me, but I'd prefer to keep them out of the initial set of
coding guidelines.  I would, however, expect that they will be one of
the first advanced features to make their way into GCC in the future.

-- 
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713



More information about the Gcc mailing list