Anonymous Namespaces
Gabriel Dos Reis
gdr@integrable-solutions.net
Sun Feb 1 05:25:00 GMT 2004
Chris Lattner <sabre@nondot.org> writes:
[...]
| I am perfectly willing to leave LLVM out of this. The whole point of me
| getting involved with the thread is to make GCC not do stupid things with
| an idiom that I commonly use. Specifically, you have shot this down as
| impossible in the past and I haven't said anything, so I figured that it
| would get shot down again unless I did. The fact that LLVM already
| performs these optimizations is secondary to the discussion.
I think your using "shot down" is descriptive how you think I view
this issue and the way the discussion went.
The least I can say is that that view is unfounded.
I'm not there to shot down optimizations. I'm specifically arguing
that
(1) whatever is done, the semantics of well-formed programs should not
be transmuted. And it was not clear to me that everybody
involved in the discussion had in the fore the interaction of
static vs. name lookup.
(2) anything is done should be done so with full knowledge of its
impact on the rest of language.
In order words, I prefer "sorry" to "oops".
What is impossible is saying any function in unnamed namespace is
declared static. The second thing is that what appears to be
static-specific optimizaation is not. It is often said that when your
tool is a hammer, everything starts looking like a nail. I don't want
us start turning everything into static just to be able to apply an
optimization which can be done under broader conditions, without
transmutation. It looks like we now have a plan to implement
something that is not disruptive.
[...]
| So, finally, to clear this mess up, do you acknowledge that this is
| possible to implement in GCC (and in fact, should not be hard)? Like
Yes, the optimization is possible without turning things into static.
-- Gaby
More information about the Gcc
mailing list