On Tue, 18 Oct 2011 10:50:11 -0700 Ian Lance Taylor <i...@google.com> wrote: > > I think a better approach here is likely to be a reference counted > shared_ptr for the > most general case. It's true that it works poorly with cycles, but > gcc data structures > are only occasionally cyclical. > > Also, I think that actually many cases in gcc do not require > shared_ptr. Instead, we > can think of terms of pools, with the smart pointers being aware of > which pool they are > associated with. Then we can detect at compile time an accidental use > of a pointer to > one pool being assigned to a pointer to a different pool. Before we > introduced garbage > collection, gcc used pools (well, obstacks), but there were severe > problems because > pointers to one pool would be assigned to a pointer to a different > pool and then become > dangling pointers when the first pool was deleted. C++ will let us > avoid that problem.
Where we probably disagree, is that you Ian believe apparently that such an ad-hoc approach is scalable to a 10MLOC software with contributions by hundreds of people (most of them understanding only a tiny part of GCC), while I Basile believe that such approach won't work in practice, because of the enormous size of GCC [it is more and more a ten million lines program] and the large size [hundred of developers] & heterogeneity [many developers, me included, understand a tiny part of GCC] of its developpers' community. My personal feeling is that human blood (the one flowing in developers' brains] is the resource that is the scariest in GCC. It is more expensive than CPU time or RAM modules. And I am a bit concerned about the too small number of young people attracted to work inside GCC. So stuff that would help them, even if GCC takes a few more milliseconds to compile files, is from my point of view important. And I think an automated GC would help them. (Or perhaps should we wait to switch to C++ till C++2011 is common enough, and provide good enough GCs). Cheers. -- Basile STARYNKEVITCH http://starynkevitch.net/Basile/ email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359 8, rue de la Faiencerie, 92340 Bourg La Reine, France *** opinions {are only mine, sont seulement les miennes} ***