From: Helmut Jarausch on
Hi,

can anybody please explain the following warning to me

.../include/zthread/PoolExecutor.h:58: warning:
'ZThread::PoolExecutor' has a field 'ZThread::PoolExecutor::_impl' whose
type uses the anonymous namespace

Many thanks for a hint,

Helmut Jarausch

Lehrstuhl fuer Numerische Mathematik
RWTH - Aachen University
D 52056 Aachen, Germany

--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

From: Martin Vuille on
"Jyoti Sharma" <jyoti.mickey(a)gmail.com> wrote in
news:op.ukx6jwbotp94fi(a)jyoti:

>
> 2. Items defined in an unnamed namespace have internal linkage.
>

Is that true? Where is it guaranteed by the standard? This has
not been my experience.

MV

--
I do not want replies; please follow-up to the group.

[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

From: Joe Smith on

"Martin Vuille" <clcppm-poster(a)this.is.invalid> wrote in message
news:Xns9B5D54682E056jpmvrealtime(a)127.0.0.1...
> "Jyoti Sharma" <jyoti.mickey(a)gmail.com> wrote in
> news:op.ukx6jwbotp94fi(a)jyoti:
>
>>
>> 2. Items defined in an unnamed namespace have internal linkage.
>>
>
> Is that true? Where is it guaranteed by the standard? This has
> not been my experience.
>
No C++03's footnote 83 is clear on this:
Although entities in an unnamed namespace might have external linkage, they
are
effectively qualified by a name unique to their translation unit and
therefore
can never be seen from any other translation unit.

The problem here though is that it will be unusuable in other translation
units, as only a forward declaration could be made for
ZThread::PoolExecutor.
If one were to include a full class definition in a different translation
unit, the two definitions would not be equivelent since the _impl member
would have a different type in each. This results in undefined behavior
as per [basic.def.odr]/5.


--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

From: Francis Glassborow on
Martin Vuille wrote:
> "Jyoti Sharma" <jyoti.mickey(a)gmail.com> wrote in
> news:op.ukx6jwbotp94fi(a)jyoti:
>
>> 2. Items defined in an unnamed namespace have internal linkage.
>>
>
> Is that true? Where is it guaranteed by the standard? This has
> not been my experience.
>
> MV
>

IIRC it is false. Names declared in an unnamed namespace have external
linkage but their fully qualified name is unutterable.

--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]