[Bug c++/29365] Unnecessary anonymous namespace warnings

bangerth at dealii dot org gcc-bugzilla@gcc.gnu.org
Tue Aug 28 21:41:00 GMT 2007



------- Comment #36 from bangerth at dealii dot org  2007-08-28 21:40 -------
(In reply to comment #35)

> In this case, the warning is correct as Impl will be different in each
> Translation Unit so X can never be the same between two of them.

That's what I thought too at first, but the request is valid anyway as long
as you never use the pointer to the class from anywhere except the one
implementation file in which the class is defined. Never using means not
even passing around the pointer, i.e. the class better not has an inline
function in the header file in which the pointer is used. However, as long
as the entire handling of the pointer is inside a single TU, nothing is
wrong with the code.

Now, whether that's good style is clearly a different matter...

W.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29365



More information about the Gcc-bugs mailing list