This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: C compile time
- From: Wolfgang Bangerth <bangerth at ices dot utexas dot edu>
- To: Chris Lattner <sabre at nondot dot org>
- Cc: Jan Hubicka <jh at suse dot cz>, Richard Guenther <rguenth at tat dot physik dot uni-tuebingen dot de>, <gcc at gcc dot gnu dot org>
- Date: Wed, 18 Jun 2003 13:24:43 -0500
- Subject: Re: C compile time
- References: <Pine.LNX.4.44.0306181321310.14133-100000@nondot.org>
> > > How much of this is because anonymous namespaces are not marking their
> > > contents as static?
> >
> > Even if they did, I don't think it would be a big thing. Most functions
> > in C++ should be member functions, and then they can't be static.
>
> That's not true. If defined in an anonymous namespace, the member
> functions are not directly accessable to other translation units, thus the
> symbols would be marked private. Anonymous namespaces effectively make
> them static, it's just that the optimizer is not currently able to take
> advantage of this piece of semantic information...
Yes, yes, I understand that :-) It's just an observation that not a whole lot
of code is being placed into anonymous namespaces, whether it being functions
are whole classes.
As an analogy: Where in C you would have the functions implementing an
internal interface to some data structure as static functions, they would
most likely be private/protected member functions of a class in C++, but if
that class has also a public interface (the usual case), then the class
cannot be part of an anonymous namespace.
Or do you mean you want to place the implementation of a member functions of a
publicly visible class into an anonymous namespace? That would strike me as a
particularly bad and error-prone style...
W.
-------------------------------------------------------------------------
Wolfgang Bangerth email: bangerth@ices.utexas.edu
www: http://www.ices.utexas.edu/~bangerth/