On Tue, Aug 28, 2007 at 02:33:23AM +0000, Angus Leeming wrote:
> Andre Poenitz <[EMAIL PROTECTED]> writes:
> > So anybody who remembers the reasons to use the anon namespace (for
> > _functions_)? [Rhetorical question...]
> 
> I seem to remember that Lars told us that it was "a good thing" (TM). 
> However, 
> before anyone indulges in a "let's bash Lars bit of nostalgia", here's what 
> Stroustrup has to say in "The C++ programming language", 3rd ed:
> 
> Section 9.2. Linkage
> 
>        In C and older C++ programs, the keyword static is (confusingly) used 
> to mean "use internal linkage" (ChB.2.3). Don't use static except inside 
> functions (Ch 7.1.2) and classes (Ch 10.2.4).

Well, this does not really give a technical reason why namespaces should
prefered. And I don't buy that "(confusingly)", even from Stroustrup.
After all, static on file scope _means_ internal linkage, also in C++.

Or are you aware of any other means to achieve the same?

> So, whilst this certainly doesn't invalidate your experiment, I think
> that we should also take a rain check and ask just how much does
> following Stroustrup's advice really hurt in practice.
> 
> If it costs 3 secs on a full compile, then any conclusions are
> essentially worthless ;-)

Why? 

To measure overall performance difference I'd have to try it out.

After that, the work is already done and in case there were _any_
improvement (which I do not doubt right now) I do not see that we
should stick to the namespace version just because BS said so.

Andre'

Reply via email to