Boost logo

Boost :

From: Fernando Cacciola (fcacciola_at_[hidden])
Date: 2002-01-31 08:51:19

----- Original Message -----
From: Yitzhak Sapir <ysapir_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Thursday, January 31, 2002 9:46 AM
Subject: RE: [boost] boost bind/functional/reference wrapper/mem_fn

> MSVC getting confused about the precompiled headers with anonymous
> namespace is a bug in MSVC. Anonymous namespace should have been
> transparent with regards to precompiled headers. Therefore, if "static"
> fixes it in MSVC, then that's all that is needed. Then you can #ifdef
> it in MSVC and non-MSVC wouldn't see the static. My test seems to show
> that declaring it static fixes it. So I'd be happy with that.
> Does Borland have a problem with the non-static definitions in the
> anonymous namespace in precompiled headers?
Actually, it does...
It has problems with precompiled headers and unnamed namespaces (apparently,
inside a named namespace).
You can look in the archives for a message with subject "boost::tuples and
internal compiler error F1004"

I think that the problem with unnamed namespaces (the term used by the std
is 'unnamed', not 'anonymous') is that it requires a hidden name unique to
a translation unit. If you precompile a header which has an unnamed
namespace, when that header is loaded, precompiled as it is, in a second
translation unit, the compiler must 'fix' the hidden namespace name because
it ought to be different in this second TU.

Whenever you experiment with precompiled headers, make sure to use also a
second TU which uses it. In the case of the Borland bug, the csm is
generated OK, but the compiler ICEs (Internal Compiler Error) if it tries to
use it.

BTW, in order to give an object internal linkage, you can use 'const' as
well, not only 'static'. In the case of the placeholders, I think they could
be constant. However, this still produces initialized data which prevents
headers to be precompiled in most compilers.

Fernando Cacciola
Sierra s.r.l.

Boost list run by bdawes at, gregod at, cpdaniel at, john at