Re: Using C++ in GCC is OK

2010-06-04 Thread Gabriel Dos Reis
On Fri, Jun 4, 2010 at 7:55 PM, Jeff Law wrote: > On 06/04/10 18:48, Mark Mitchell wrote: >> >>   In C++, you can of course make what looks like >> simple code do something expensive; for example, you can make "a + b" be >> arbitrarily complex if "a" and "b" are instances of class types and you >>

Re: Using C++ in GCC is OK

2010-06-04 Thread Mark Mitchell
Jeff Law wrote: >>In C++, you can of course make what looks like >> simple code do something expensive; for example, you can make "a + b" be >> arbitrarily complex if "a" and "b" are instances of class types and you >> have overloaded "+". >> > And, in general, we are trying to avoid situa

Re: Using C++ in GCC is OK

2010-06-04 Thread Jeff Law
On 06/04/10 18:48, Mark Mitchell wrote: In C++, you can of course make what looks like simple code do something expensive; for example, you can make "a + b" be arbitrarily complex if "a" and "b" are instances of class types and you have overloaded "+". And, in general, we are trying to av

Re: Using C++ in GCC is OK

2010-06-04 Thread Mark Mitchell
Joseph S. Myers wrote: > I repeat my request from the RM Q&A for a guide for reviewers on how to > detect hidden overhead in the presence of C++ features. When will a > structure/class/union be larger than might be expected in C? When will > C++ statements involve runtime overhead that might

Re: Using C++ in GCC is OK

2010-06-04 Thread Jonathan Wakely
On 4 June 2010 21:55, Ian Lance Taylor wrote: > > I think we should change the gcc major release to 5 when we change the > libstdc++.so major version number to 7. I don't speak for the other libstdc++ maintainers, but I think that's a great idea.

Re: Using C++ in GCC is OK

2010-06-04 Thread Gabriel Dos Reis
On Fri, Jun 4, 2010 at 3:55 PM, Ian Lance Taylor wrote: > "Joseph S. Myers" writes: > > I think we should change the gcc major release to 5 when we change the > libstdc++.so major version number to 7. seconded. -- Gaby

Re: Using C++ in GCC is OK

2010-06-04 Thread Ian Lance Taylor
"Joseph S. Myers" writes: > On Wed, 2 Jun 2010, Bingfeng Mei wrote: > >> Converting to C++ is a major change. Does that justify to have a major >> release (5.0.0)? > > No. It's not in any way user-visible. In principle I agree with what > Zack said in

Re: Using C++ in GCC is OK

2010-06-04 Thread Joseph S. Myers
On Mon, 31 May 2010, Ian Lance Taylor wrote: > I have written a proposed set of C++ coding conventions on the wiki at > http://gcc.gnu.org/wiki/CppConventions > > This is only a preliminary proposal. It requires fleshing out and > discussion. Comments welcome. I think the coding style warn

Re: Using C++ in GCC is OK

2010-06-04 Thread Joseph S. Myers
On Tue, 1 Jun 2010, Paolo Bonzini wrote: > > I think compiler can and should be host independent, like LLVM. > > It is. Changes to code generation depending on the host are considered to be > serious bugs, and have been long before LLVM existed. I'd like that to be the case, but PR 35466 was cl

RE: Using C++ in GCC is OK

2010-06-04 Thread Joseph S. Myers
On Wed, 2 Jun 2010, Bingfeng Mei wrote: > Converting to C++ is a major change. Does that justify to have a major > release (5.0.0)? No. It's not in any way user-visible. In principle I agree with what Zack said in on version numbers; certainl

Re: Using C++ in GCC is OK

2010-06-04 Thread Joseph S. Myers
On Wed, 2 Jun 2010, Richard Guenther wrote: > I'd like us to stick with C comments only. I defintely do not like > a mix of both styles and I can't see an advantage of C++ comments. Agreed. Moving code between bits of the compiler should not mean creating ugly inconsistencies of formatting and

Re: Using C++ in GCC is OK

2010-06-04 Thread Kai Tietz
Hi, What's about the "friend"s in C++.. I think it should be forbidden by C++ coding-style, as it is mainly a sign of weak OO design to use them. Kai | (\_/) This is Bunny. Copy and paste | (='.'=) Bunny into your signature to help | (")_(") him gain world domination

Re: Using C++ in GCC is OK

2010-06-04 Thread Diego Novillo
On Thu, Jun 3, 2010 at 13:42, Andrew Haley wrote: > I'll turn that into a question: does any GCC maintainer intend to convert > working code into C++, with no substantive changes? Not me. Mostly new code and re-engineer only those parts where the value of C++ is a clear advantage. Diego.

Re: Using C++ in GCC is OK

2010-06-04 Thread Larry Evans
On 06/03/10 14:39, Steinar Bang wrote: Larry Evans : claims that switch statements are faster than virtual function calls. That's not really interesting, is it? The overhead and downsides of virtual functions are well known. The upside is the possibility to use polymorphism to make framewo

Re: Using C++ in GCC is OK

2010-06-04 Thread Andrew Haley
On 06/03/2010 09:47 PM, Robert Dewar wrote: > Andrew Haley wrote: > >> Right, but I didn't think there was any plan to convert en masse to >> C++ -- just to allow people to use it where appropriate. Apart from >> anything else, there's always a nonzero probablility of breaking >> something. > >

Re: Using C++ in GCC is OK

2010-06-03 Thread Jonathan Wakely
On 3 June 2010 20:35, Steinar Bang wrote: >> Mark Mitchell : > >> 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

Re: Using C++ in GCC is OK

2010-06-03 Thread Robert Dewar
Steinar Bang wrote: Mark Mitchell : 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. Umm...? Virtual

Re: Using C++ in GCC is OK

2010-06-03 Thread Robert Dewar
Andrew Haley wrote: Right, but I didn't think there was any plan to convert en masse to C++ -- just to allow people to use it where appropriate. Apart from anything else, there's always a nonzero probablility of breaking something. It's the "where appropriate" that is the sneaky detail here :

RE: Using C++ in GCC is OK

2010-06-03 Thread Hargett, Matt
> On Thu, Jun 3, 2010 at 6:09 AM, Richard Guenther > wrote: > > > Indeed ;)  I'd like us to switch to the C / C++ common soon (thus, > > use C for stage1 and C++ for stage2 and stage3).  That will help > > us sort out problems on the various host/target combinations that > > will surely exist. >

Re: Using C++ in GCC is OK

2010-06-03 Thread Ian Lance Taylor
Steinar Bang writes: >> Mark Mitchell : > >> 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.

Re: Using C++ in GCC is OK

2010-06-03 Thread Steinar Bang
> Larry Evans : > claims that switch statements are faster than virtual function calls. That's not really interesting, is it? The overhead and downsides of virtual functions are well known. The upside is the possibility to use polymorphism to make frameworks. All kinds of pluggable framewor

Re: Using C++ in GCC is OK

2010-06-03 Thread Steinar Bang
> Mark Mitchell : > 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. Umm...? Virtual functions

Re: Using C++ in GCC is OK

2010-06-03 Thread Basile Starynkevitch
On Thu, 2010-06-03 at 13:05 -0500, Gabriel Dos Reis wrote: > On Thu, Jun 3, 2010 at 6:09 AM, Richard Guenther > wrote: > > > Indeed ;) I'd like us to switch to the C / C++ common soon (thus, > > use C for stage1 and C++ for stage2 and stage3). That will help > > us sort out problems on the vari

Re: Using C++ in GCC is OK

2010-06-03 Thread Gabriel Dos Reis
On Thu, Jun 3, 2010 at 6:09 AM, Richard Guenther wrote: > Indeed ;)  I'd like us to switch to the C / C++ common soon (thus, > use C for stage1 and C++ for stage2 and stage3).  That will help > us sort out problems on the various host/target combinations that > will surely exist. Here is a concr

Re: Using C++ in GCC is OK

2010-06-03 Thread Andrew Haley
On 06/03/2010 12:09 PM, Richard Guenther wrote: > On Thu, Jun 3, 2010 at 12:51 PM, Robert Dewar wrote: >> Steven Bosscher wrote: >> >>> Indeed. It is, well, perhaps not surprising, but quite annoying (to me >>> at least) that a possible move to C++ as implementation language of >>> GCC is so much

Re: Using C++ in GCC is OK

2010-06-03 Thread Toon Moene
On 06/03/2010 12:51 PM, Robert Dewar wrote: Steven Bosscher wrote: Indeed. It is, well, perhaps not surprising, but quite annoying (to me at least) that a possible move to C++ as implementation language of GCC is so much bigger news than all the amazing amounts of work done in the last few yea

Re: Using C++ in GCC is OK

2010-06-03 Thread Richard Guenther
On Thu, Jun 3, 2010 at 12:51 PM, Robert Dewar wrote: > Steven Bosscher wrote: > >> Indeed. It is, well, perhaps not surprising, but quite annoying (to me >> at least) that a possible move to C++ as implementation language of >> GCC is so much bigger news than all the amazing amounts of work done >

Re: Using C++ in GCC is OK

2010-06-03 Thread Robert Dewar
Steven Bosscher wrote: Indeed. It is, well, perhaps not surprising, but quite annoying (to me at least) that a possible move to C++ as implementation language of GCC is so much bigger news than all the amazing amounts of work done in the last few years on things like LTO, the vectorizer, IRA, et

Re: Using C++ in GCC is OK

2010-06-03 Thread Steven Bosscher
On Thu, Jun 3, 2010 at 10:24 AM, Andrew Haley wrote: > On 06/02/2010 09:19 PM, DJ Delorie wrote: >> >> Robert Dewar writes: >>> I would create a specific committee to reccommend a C++ coding >>> standard (preferably based on one of the standard ones available, such >>> as Google). >> >> Doing thi

Re: Using C++ in GCC is OK

2010-06-03 Thread Paolo Bonzini
On 06/01/2010 08:10 AM, Ian Lance Taylor wrote: Mark Mitchell writes: I am pleased to report that the GCC Steering Committee and the FSF have approved the use of C++ in GCC itself. Of course, there's no reason for us to use C++ features just because we can. The goal is a better compiler for

Re: Using C++ in GCC is OK

2010-06-03 Thread Andrew Haley
On 06/02/2010 09:19 PM, DJ Delorie wrote: > > Robert Dewar writes: >> I would create a specific committee to reccommend a C++ coding >> standard (preferably based on one of the standard ones available, such >> as Google). > > Doing things in secret like that is not the Open Source Way. No, havi

Re: Using C++ in GCC is OK

2010-06-02 Thread 徐持恒
>> STL is good, but may surplus what GCC really needs, and will introduce >> many complex, "uncontrollable" C++ features. >> >> >> Personally, I think what GCC need most is  an simple, generic, one >> layer containers of pointers to objects,  with their iterators. >> Instead of containers of arbitr

Re: Using C++ in GCC is OK

2010-06-02 Thread DJ Delorie
> You've already convinced me, but you originally described a problem > where emacs' paragraph formatting would incorrectly rearrange > multi-line C++ comments. Out of personal curiosity, does emacs > actually have a bug in this regard or not? It happens to work correctly in a well-formed C++ tes

RE: Using C++ in GCC is OK

2010-06-02 Thread Hargett, Matt
> >> I'm not sure i agree with this, because I don't see anything wrong > >> with multi-line C++-style comments. > > > > I'm with Ian on this one. Is there a reason for this, other than > one's > > personal tool preference for editing code may make C-style multi-line > > comments easier to add/remo

Re: Using C++ in GCC is OK

2010-06-02 Thread DJ Delorie
Robert Dewar writes: > I would create a specific committee to reccommend a C++ coding > standard (preferably based on one of the standard ones available, such > as Google). Doing things in secret like that is not the Open Source Way.

Re: Using C++ in GCC is OK

2010-06-02 Thread Joern Rennecke
Quoting Richard Earnshaw : A missing virtual hook would be a build failure, rather than a runtime error. So the advantage is easier maintenance. If we really wanted to have a target hook without a valid default, we could have it right now by using a default that causes a link or even a compil

Re: Using C++ in GCC is OK

2010-06-02 Thread Jakub Jelinek
On Wed, Jun 02, 2010 at 06:52:11PM +0100, Richard Earnshaw wrote: > > Currently targetm is a struct with function pointers, so calling > > targetm.hook_xyz (); > > means reading a pointer from &targetm + off, then calling it. > > If you make it a class with virtual functions and targetm > > would b

Re: Using C++ in GCC is OK

2010-06-02 Thread Richard Earnshaw
On Wed, 2010-06-02 at 19:50 +0200, Jakub Jelinek wrote: > On Wed, Jun 02, 2010 at 06:17:25PM +0100, Richard Earnshaw wrote: > > > > On Mon, 2010-05-31 at 10:02 -0700, Mark Mitchell wrote: > > > I think virtual functions are on the edge; quite useful, but do result > > > in the compiler adding a p

Re: Using C++ in GCC is OK

2010-06-02 Thread Richard Kenner
> Provided that the object format for binaries is published and that we > can therefore create some binutils tools as well. No. You build a cross-COMPILER, not a cross-assembler. You use the assembler on the target.

Re: Using C++ in GCC is OK

2010-06-02 Thread Jakub Jelinek
On Wed, Jun 02, 2010 at 06:17:25PM +0100, Richard Earnshaw wrote: > > On Mon, 2010-05-31 at 10:02 -0700, Mark Mitchell 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

Re: Using C++ in GCC is OK

2010-06-02 Thread Mark Mitchell
Richard Earnshaw 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. > > We do, of course,

Re: Using C++ in GCC is OK

2010-06-02 Thread Richard Earnshaw
On Mon, 2010-05-31 at 08:22 -0400, Robert Dewar wrote: > Gcc is very widespread at this point. Yes, there is the issue > of completely new targets, but these can be easily handled by > building cross-compilers. Provided that the object format for binaries is published and that we can therefore cre

Re: Using C++ in GCC is OK

2010-06-02 Thread Richard Earnshaw
On Mon, 2010-05-31 at 10:02 -0700, Mark Mitchell 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

Re: Using C++ in GCC is OK

2010-06-02 Thread Dave Korn
On 02/06/2010 17:22, Richard Guenther wrote: > template > void mark(const T&) { gcc_unreachable (); } > > we might be safe to not miss implementations for something gengtype > does not handle itself. Wouldn't template void mark(const T&) { gcc_does_not_exist_causes_link_failure (); } do an e

Re: Using C++ in GCC is OK

2010-06-02 Thread Richard Guenther
On Wed, Jun 2, 2010 at 6:03 PM, Tom Tromey wrote: >> "Basile" == Basile Starynkevitch writes: > > Basile> Still, my concerns on C++ is mostly gengtype related. I believe we > need > Basile> to keep a garbage collector even with C++, and I believe that changing > Basile> gengtype to follow C+

Re: Using C++ in GCC is OK

2010-06-02 Thread Tom Tromey
> "Basile" == Basile Starynkevitch writes: Basile> Still, my concerns on C++ is mostly gengtype related. I believe we need Basile> to keep a garbage collector even with C++, and I believe that changing Basile> gengtype to follow C++ could be quite painful if we follow the usual Basile> route

Re: Using C++ in GCC is OK

2010-06-02 Thread Ian Lance Taylor
Robert Dewar writes: > A rather global comment. I think trying to do language > design by the flood-of-email method is dubious. I would > create a specific committee to reccommend a C++ coding > standard (preferably based on one of the standard ones > available, such as Google). And then when the

Re: Using C++ in GCC is OK

2010-06-02 Thread Robert Dewar
A rather global comment. I think trying to do language design by the flood-of-email method is dubious. I would create a specific committee to reccommend a C++ coding standard (preferably based on one of the standard ones available, such as Google). And then when there is a completed document, ask

Re: Using C++ in GCC is OK

2010-06-02 Thread Robert Dewar
Ian Lance Taylor wrote: Richard Guenther writes: I agree that that is the usual problem with overloaded operators. I don't really agree that that is a problem in this specific case. We have to do those operations anyhow. I don't think the ease of writing the code is going to cause us to do

Re: Using C++ in GCC is OK

2010-06-02 Thread Gabriel Dos Reis
On Wed, Jun 2, 2010 at 9:33 AM, Emílio Wuerges wrote: > Now that we are talking about STL & templates: What about boost? My personal inclination it to keep the dependencies strictly to a C++98 implementation. When times come that we need more dependencies and the benefits clearly demonstrated, t

Re: Using C++ in GCC is OK

2010-06-02 Thread Jonathan Wakely
On 2 June 2010 15:05, Paolo Bonzini wrote: > On 06/02/2010 03:01 PM, Gabriel Dos Reis wrote: >> >> In the guidelines, I would like to include: >>    (2) if you define a class template used mostly with pointer type >> arguments, >>         consider specializing for void* (or const void*) and define

Re: Using C++ in GCC is OK

2010-06-02 Thread Jonathan Wakely
On 2 June 2010 15:33, Emílio Wuerges wrote: > Now that we are talking about STL & templates: What about boost? The requirement for a C++98 compiler is a much weaker requirement than C++98 compiler + working Boost. Boost is not tested on most of the platforms that GCC targets. Also, Boost APIs are

Re: Using C++ in GCC is OK

2010-06-02 Thread Emílio Wuerges
Now that we are talking about STL & templates: What about boost? On Wed, Jun 2, 2010 at 11:22 AM, Gabriel Dos Reis wrote: > On Wed, Jun 2, 2010 at 9:05 AM, Paolo Bonzini wrote: >> On 06/02/2010 03:01 PM, Gabriel Dos Reis wrote: >>> >>> In the guidelines, I would like to include: >>>    (2) if yo

Re: Using C++ in GCC is OK

2010-06-02 Thread Gabriel Dos Reis
On Wed, Jun 2, 2010 at 9:05 AM, Paolo Bonzini wrote: > On 06/02/2010 03:01 PM, Gabriel Dos Reis wrote: >> >> In the guidelines, I would like to include: >>    (2) if you define a class template used mostly with pointer type >> arguments, >>         consider specializing for void* (or const void*)

Re: Using C++ in GCC is OK

2010-06-02 Thread Paolo Bonzini
On 06/02/2010 03:54 PM, Ian Lance Taylor wrote: Richard Guenther writes: On Tue, Jun 1, 2010 at 6:58 PM, Ian Lance Taylor wrote: Richard Guenther writes: Overall the wiki document looks good. I'd like to disallow * Operators may only be overloaded for types which implement numeric value

Re: Using C++ in GCC is OK

2010-06-02 Thread Paolo Bonzini
On 06/02/2010 03:01 PM, Gabriel Dos Reis wrote: In the guidelines, I would like to include: (2) if you define a class template used mostly with pointer type arguments, consider specializing for void* (or const void*) and define all other pointer specialization in terms of th

Re: Using C++ in GCC is OK

2010-06-02 Thread Ian Lance Taylor
Richard Guenther writes: > On Tue, Jun 1, 2010 at 6:58 PM, Ian Lance Taylor wrote: >> Richard Guenther writes: >> >>> Overall the wiki document looks good.  I'd like to disallow >>> >>> * Operators may only be overloaded for types which implement numeric >>> values, where the overloaded operato

Re: Using C++ in GCC is OK

2010-06-02 Thread Ian Lance Taylor
Laurynas Biveinis writes: > 2010/6/2 Ian Lance Taylor : >>> Ian, do you have an idea on how to avoid _M_impl dependency in >>> gengtype or what else to do about it? >>> >>> Because we can trivially make gengtype mark the vector itself and mark >>> whatever was put into vector, but not _M_impl. >>

Re: Using C++ in GCC is OK

2010-06-02 Thread Ian Lance Taylor
Jakub Jelinek writes: > But do we really want to use std::vector? The vec.h, appart from > having ugly syntactic sugar, seems to be more space efficient, has better > aliasing properties (given that it is just one pointer, you can e.g. use > restrict on it easily) and seems to have more operatio

Re: Using C++ in GCC is OK

2010-06-02 Thread Gabriel Dos Reis
On Wed, Jun 2, 2010 at 4:35 AM, Richard Guenther wrote: > On Wed, Jun 2, 2010 at 2:49 AM, Gabriel Dos Reis > wrote: >> On Tue, Jun 1, 2010 at 7:38 PM, DJ Delorie wrote: >>> >>> "Hargett, Matt" writes: > As noted earlier I think we do want to use some STL classes. I agree with Mark

Re: Using C++ in GCC is OK

2010-06-02 Thread Richard Guenther
On Wed, Jun 2, 2010 at 3:04 PM, Gabriel Dos Reis wrote: > On Wed, Jun 2, 2010 at 4:19 AM, Richard Guenther > wrote: > >> I'd like us to stick with C comments only.  I defintely do not like >> a mix of both styles and I can't see an advantage of C++ comments. > > It does not have a 'gotcha' for co

Re: Using C++ in GCC is OK

2010-06-02 Thread Gabriel Dos Reis
On Wed, Jun 2, 2010 at 4:19 AM, Richard Guenther wrote: > I'd like us to stick with C comments only.  I defintely do not like > a mix of both styles and I can't see an advantage of C++ comments. It does not have a 'gotcha' for commenting out codes.

Re: Using C++ in GCC is OK

2010-06-02 Thread Gabriel Dos Reis
On Wed, Jun 2, 2010 at 2:44 AM, Paolo Bonzini wrote: > In particular, I wonder if the best use of C++ wouldn't be a set of > functions (including templates, etc.) implementing a kind of RTTI with a > less verbose syntax than what we have now. Agreed. I don't agree with the rejection of simple f

Re: Using C++ in GCC is OK

2010-06-02 Thread Richard Earnshaw
On Mon, 2010-05-31 at 08:40 -0700, Mark Mitchell wrote: > Eric Botcazou wrote: > > >> We do require long long for 32->64 cross compilers. > > > > Right, only in this case, and I don't see why this should be changed with > > the > > transition to C++, that's orthogonal. > > I agree. We need i

Re: Using C++ in GCC is OK

2010-06-02 Thread Gabriel Dos Reis
On Wed, Jun 2, 2010 at 1:22 AM, Ian Lance Taylor wrote: > Basile Starynkevitch writes: > >> On Tue, 2010-06-01 at 19:49 -0500, Gabriel Dos Reis wrote: >>>     (2) we should prefer standard solution over home-grown hacks, unless >>>          there is a clear demonstration of value.  For example, i

Re: Using C++ in GCC is OK

2010-06-02 Thread Gabriel Dos Reis
On Tue, Jun 1, 2010 at 11:43 PM, Basile Starynkevitch wrote: > On Tue, 2010-06-01 at 19:49 -0500, Gabriel Dos Reis wrote: >>     (2) we should prefer standard solution over home-grown hacks, unless >>          there is a clear demonstration of value.  For example, it would be >>          unwise to

Re: Using C++ in GCC is OK

2010-06-02 Thread Michael Matz
Hi, On Wed, 2 Jun 2010, Richard Guenther wrote: > Well, on the one hand I agree - but on the other hand I see people > eagerly waiting to be the first to post patches to convert all VEC uses > that allocate from the heap(!) (yes - we can't use STL for GC allocated > stuff!), leaving us with fi

Re: Using C++ in GCC is OK

2010-06-02 Thread Michael Matz
Hi, On Tue, 1 Jun 2010, Ian Lance Taylor wrote: > >> > * Use C-style comments for multi-line comments, and C++-style comments > >> > for single-line comments. > >> > >> I'm not sure i agree with this, because I don't see anything wrong > >> with multi-line C++-style comments. > > > > It assume

Re: Using C++ in GCC is OK

2010-06-02 Thread Paolo Bonzini
Well, on the one hand I agree - but on the other hand I see people eagerly waiting to be the first to post patches to convert all VEC uses that allocate from the heap(!) (yes - we can't use STL for GC allocated stuff!), leaving us with files that use a mix of stl::vector and VEC. VEC is clearly s

Re: Using C++ in GCC is OK

2010-06-02 Thread Dave Korn
On 02/06/2010 00:38, Ian Lance Taylor wrote: > DJ Delorie writes: * Use C-style comments for multi-line comments, and C++-style comments for single-line comments. >>> I'm not sure i agree with this, because I don't see anything wrong >>> with multi-line C++-style comments. >> It assum

RE: Using C++ in GCC is OK

2010-06-02 Thread Bingfeng Mei
J Delorie; Hargett, Matt; gcc@gcc.gnu.org > Subject: Re: Using C++ in GCC is OK > > On Wed, Jun 2, 2010 at 2:49 AM, Gabriel Dos Reis > wrote: > > On Tue, Jun 1, 2010 at 7:38 PM, DJ Delorie wrote: > >> > >> "Hargett, Matt" writes: > >>>

Re: Using C++ in GCC is OK

2010-06-02 Thread Richard Guenther
On Wed, Jun 2, 2010 at 2:49 AM, Gabriel Dos Reis wrote: > On Tue, Jun 1, 2010 at 7:38 PM, DJ Delorie wrote: >> >> "Hargett, Matt" writes: As noted earlier I think we do want to use some STL classes. >>> >>> I agree with Mark's earlier declaration that it is relatively >>> straight-forward,

Re: Using C++ in GCC is OK

2010-06-02 Thread Eric Botcazou
> I'd like us to stick with C comments only. I defintely do not like > a mix of both styles and I can't see an advantage of C++ comments. It indeed seems to fall into the buy-us-nothing category. -- Eric Botcazou

Re: Using C++ in GCC is OK

2010-06-02 Thread Richard Guenther
On Wed, Jun 2, 2010 at 1:38 AM, Ian Lance Taylor wrote: > DJ Delorie writes: > >>> I did mean that all virtual functions should be protected. >> >> This forbids the most useful thing about virtual functions - letting >> child classes implement a public ABI defined by the base class. > > There are

Re: Using C++ in GCC is OK

2010-06-02 Thread Richard Guenther
On Tue, Jun 1, 2010 at 6:37 PM, Robert Dewar wrote: > Richard Guenther wrote: >> >> On Tue, Jun 1, 2010 at 4:48 PM, Mark Mitchell >> wrote: >>> >>> Ian Lance Taylor wrote: >>> I have written a proposed set of C++ coding conventions on the wiki at    http://gcc.gnu.org/wiki/CppConvention

Re: Using C++ in GCC is OK

2010-06-02 Thread Richard Guenther
On Tue, Jun 1, 2010 at 6:58 PM, Ian Lance Taylor wrote: > Richard Guenther writes: > >> Overall the wiki document looks good.  I'd like to disallow >> >> * Operators may only be overloaded for types which implement numeric >> values, where the overloaded operators implement the usual numeric >> s

Re: Using C++ in GCC is OK

2010-06-02 Thread Jakub Jelinek
On Wed, Jun 02, 2010 at 08:28:53AM +0200, Laurynas Biveinis wrote: > See http://gcc.gnu.org/wiki/gcc-in-cxx , section "Major TODO": > work out the details of using STL containers with GC allocated > objects. This means teaching gengtype how to generate code to traverse > STL containers, which would

Re: Using C++ in GCC is OK

2010-06-02 Thread Paolo Bonzini
On 06/01/2010 04:11 PM, Ian Lance Taylor wrote: In the gccgo IR I don't represent everything with a single type. Instead, I use a separate base class for types, expressions and statements (in Go there is more of a distinction between expressions and statements than there is in C/C++). I represe

Re: Using C++ in GCC is OK

2010-06-01 Thread Laurynas Biveinis
2010/6/2 Ian Lance Taylor : >> Ian, do you have an idea on how to avoid _M_impl dependency in >> gengtype or what else to do about it? >> >> Because we can trivially make gengtype mark the vector itself and mark >> whatever was put into vector, but not _M_impl. > > I don't think I understand the qu

Re: Using C++ in GCC is OK

2010-06-01 Thread Ian Lance Taylor
Laurynas Biveinis writes: > 2010/6/2 Ian Lance Taylor : >> As you say, gengtype includes specific support for VEC.  Using >> std::vector instead will require some work in gengtype, but not too >> much.  Currently gengtype generates code like this for a VEC: >> >>        size_t l0 = (size_t)(((*x)

Re: Using C++ in GCC is OK

2010-06-01 Thread Laurynas Biveinis
2010/6/2 Ian Lance Taylor : > As you say, gengtype includes specific support for VEC.  Using > std::vector instead will require some work in gengtype, but not too > much.  Currently gengtype generates code like this for a VEC: > >        size_t l0 = (size_t)(((*x).base).num); >        for (i0 = 0;

Re: Using C++ in GCC is OK

2010-06-01 Thread Laurynas Biveinis
2010/6/2 Basile Starynkevitch : > I am not entirely convinced of that. VEC is supported not only by > infamous vec.h macros (which we surely want to replace by some template, > possibly std::vec) but also by gengtype (and the Gcc Garbage Collector). > > I strongly believe we will need a garbage col

Re: Using C++ in GCC is OK

2010-06-01 Thread Ian Lance Taylor
Basile Starynkevitch writes: > On Tue, 2010-06-01 at 19:49 -0500, Gabriel Dos Reis wrote: >> (2) we should prefer standard solution over home-grown hacks, unless >> there is a clear demonstration of value. For example, it would be >> unwise to prefer our current VEC_xxx ove

Re: Using C++ in GCC is OK

2010-06-01 Thread 徐持恒
> But C/C++ may have an another advantage, it can use ADT(Abstract Data > Type) to extend its set of "primitive type", e.g., string. > But C++ may have an another advantage, it can use ADT(Abstract Data Type) to extend its set of "primitive type", e.g., string. -- 徐持恒(Chiheng Xu) Wuhan,China

Re: Using C++ in GCC is OK

2010-06-01 Thread Basile Starynkevitch
On Tue, 2010-06-01 at 19:43 -0500, Gabriel Dos Reis wrote: > On Tue, Jun 1, 2010 at 7:03 PM, DJ Delorie wrote: > > > Maybe you and I have completely different ideas about how the whole > > class heirarchy works. I'm not a firm believer that the base-most > > class should be an empty shell of a c

Re: Using C++ in GCC is OK

2010-06-01 Thread Basile Starynkevitch
On Tue, 2010-06-01 at 19:49 -0500, Gabriel Dos Reis wrote: > (2) we should prefer standard solution over home-grown hacks, unless > there is a clear demonstration of value. For example, it would be > unwise to prefer our current VEC_xxx over std::vector. Conversely, >

Re: Using C++ in GCC is OK

2010-06-01 Thread 徐持恒
On Wed, Jun 2, 2010 at 9:55 AM, 徐持恒 wrote: > On Wed, Jun 2, 2010 at 8:38 AM, DJ Delorie wrote: >> >> "Hargett, Matt" writes: As noted earlier I think we do want to use some STL classes. >>> >>> I agree with Mark's earlier declaration that it is relatively >>> straight-forward, low-hanging f

Re: Using C++ in GCC is OK

2010-06-01 Thread Geert Bosch
On Jun 1, 2010, at 17:41, DJ Delorie wrote: > It assumes your editor can do block-reformatting while preserving the > comment syntax. I've had too many // cases of Emacs guessing wrong // > and putting // throughout a reformatted // block. With Ada we have no choice, and only have -- comments.

Re: Using C++ in GCC is OK

2010-06-01 Thread 徐持恒
On Wed, Jun 2, 2010 at 8:38 AM, DJ Delorie wrote: > > "Hargett, Matt" writes: >>> As noted earlier I think we do want to use some STL classes. >> >> I agree with Mark's earlier declaration that it is relatively >> straight-forward, low-hanging fruit to replace VEC_* > > I do not object to simple

Re: Using C++ in GCC is OK

2010-06-01 Thread Ian Lance Taylor
DJ Delorie writes: >> 2) The parent class does not consist only of pure virtual methods. >> In that case I am arguing that all virtual methods should be >> protected. > > What about the case where the parent provides default implementations > of methods that are infrequently overridden by childre

Re: Using C++ in GCC is OK

2010-06-01 Thread Gabriel Dos Reis
On Tue, Jun 1, 2010 at 8:41 PM, Ian Lance Taylor wrote: > Gabriel Dos Reis writes: > >> As I matter of fact, I have comments about the conventions being put forward, >> I do not know the proper way to get them reflected in the proposal. > > As I said earlier, send e-mail here, or update the wiki

Re: Using C++ in GCC is OK

2010-06-01 Thread Ian Lance Taylor
Gabriel Dos Reis writes: > As I matter of fact, I have comments about the conventions being put forward, > I do not know the proper way to get them reflected in the proposal. As I said earlier, send e-mail here, or update the wiki page. When updating the wiki page, please put your name on all c

Re: Using C++ in GCC is OK

2010-06-01 Thread Ian Lance Taylor
Bernd Schmidt writes: > On 06/02/2010 01:42 AM, Ian Lance Taylor wrote: >>> The 'this->' is needed when the current class and base class are both >>> templates and the name is declared in the base class, and not if it's >>> declared in the current class. That is not likely to happen in a >>> hur

Re: Using C++ in GCC is OK

2010-06-01 Thread Richard Kenner
> > Right, but it may happen some day. Also there is the issue of > > clarity. I think it is clearer to see this->get() rather than get(). > > this->put_size (this->get_bounds (this->get_x(), this->get_y()), > this->get_variance (this->default_variance ())) I think clarity can b

Re: Using C++ in GCC is OK

2010-06-01 Thread Gabriel Dos Reis
On Tue, Jun 1, 2010 at 8:03 PM, DJ Delorie wrote: > >> I think that would be most unproductive and misguided. > > Maybe I should step back and restate my original desires. > > I don't want us to move *too quickly* towards an all-STL > implementation, and end up with a hairy mess that's hard to > u

Re: Using C++ in GCC is OK

2010-06-01 Thread DJ Delorie
> I think that would be most unproductive and misguided. Maybe I should step back and restate my original desires. I don't want us to move *too quickly* towards an all-STL implementation, and end up with a hairy mess that's hard to understand. I've had to debug our STL implementation before, it

Re: Using C++ in GCC is OK

2010-06-01 Thread Gabriel Dos Reis
On Tue, Jun 1, 2010 at 7:38 PM, DJ Delorie wrote: > > "Hargett, Matt" writes: >>> As noted earlier I think we do want to use some STL classes. >> >> I agree with Mark's earlier declaration that it is relatively >> straight-forward, low-hanging fruit to replace VEC_* > > I do not object to simple

Re: Using C++ in GCC is OK

2010-06-01 Thread Jeff Law
On 06/01/10 17:42, Ian Lance Taylor wrote: The biggest need for this-> is when calling methods in the current class if the current class happens to be in a template. The 'this->' is needed when the current class and base class are both templates and the name is declared in the base cl

Re: Using C++ in GCC is OK

2010-06-01 Thread Gabriel Dos Reis
On Tue, Jun 1, 2010 at 7:03 PM, DJ Delorie wrote: > Maybe you and I have completely different ideas about how the whole > class heirarchy works.  I'm not a firm believer that the base-most > class should be an empty shell of a class that does nothing but > provide a placeholder for umpteen direct

Re: Using C++ in GCC is OK

2010-06-01 Thread Gabriel Dos Reis
On Tue, Jun 1, 2010 at 7:05 PM, DJ Delorie wrote: > >> Right, but it may happen some day.  Also there is the issue of >> clarity.  I think it is clearer to see this->get() rather than get(). > > this->put_size (this->get_bounds (this->get_x(), this->get_y()), >                this->get_variance (t

  1   2   3   >