C++ Logo


Advanced search

Re: [SG7] Reason for members of namespace

From: Andrew Sutton <asutton.list_at_[hidden]>
Date: Wed, 4 Nov 2020 09:25:21 -0500
> So far, we got 3/5, also attributes were re-proposed almost equally by
> someone else (maybe 4/5), so I'm happy that even though I couldn´t work
> with that and participate in last years 😞, some convergence emerged 😛!

Convergence is always a good sign :)

Back in the day I thought about a "is_first_redeclaration" predicate, I
> don't know if somebody else considered something like this, compilers
> probably maintain a pointer to previous declarations in redeclared AST
> Nodes, so it is probably cheap acquire this info, and even if you get
> out-of-order function declarations in different compilations units you
> still can get the same function name and parameter types, even in cases
> when parameter names are different;

That's not implementable in GCC without major surgery because it merges
declarations. There is no first and last declaration, only the most
recently seen. I don't believe it's the only compiler that works this way.

The approach described by P2237 is to only visit one declaration.

What is written in the proposal p1240r1.pdf
> <http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1240r1.pdf>
> page 36 puzzled me :
> "Of note here is that we are not proposing a function to retrieve
> members of namespaces: Due to their”open scope” nature, we believe that
> capability is somewhat meaningless. There is however no known technical
> reason preventing us from doing so."
> I interpreted "meaningless" in the sense of "not useful", by the previous
> answers I presume that "yes it has good uses" and also there are
> known technical issues.

I think at the time of writing, we didn't have any solid use cases in mind.


Received on 2020-11-04 08:25:35