Boost logo

Boost :

From: Jason Shirk (jasonsh_at_[hidden])
Date: 2002-02-01 03:02:11


The anonymous namespace issue has been known for years, but not fixed
yet, presumably because static works just as well (at least w/ VC.)

We do not make any restrictions on what you can use in a PCH. Anything
that doesn't work (like anonymous namespaces) is definitely a bug.

I'll look into fixing this for VC7.1.

BTW, has anyone tried this with Comeau's PCH support?

Jason Shirk
VC++ Compiler Team

> -----Original Message-----
> From: Fernando Cacciola [mailto:fcacciola_at_[hidden]]
> Sent: Thursday, January 31, 2002 6:44 AM
> To: boost_at_[hidden]
> Subject: RE: [boost] boost bind/functional/reference wrapper/mem_fn
>
>
> ----- Original Message -----
> From: Yitzhak Sapir <ysapir_at_[hidden]>
> To: <boost_at_[hidden]>
> Sent: Thursday, January 31, 2002 11:35 AM
> Subject: RE: [boost] boost bind/functional/reference wrapper/mem_fn
>
>
> > header:
> > namespace { struct a { int x; }; static a z; }
> > int sum1(int x, int y);
> > int sum2(int x, int y);
> >
> > file 1:
> > #include "stdafx.h"
> >
> > int sum2(int x, int y)
> > {
> > return x + y + z.x;
> > }
> >
> > file 2:
> > #include "stdafx.h"
> >
> > int sum1(int x, int y)
> > {
> > return x + y + z.x;
> > }
> >
> > int main(int argc, char* argv[])
> > {
> > z.x = 4;
> > int b1 = sum1(2 ,3);
> > z.x = 5;
> > int b2 = sum2(4, 3);
> > return 0;
> > }
> >
> > compiles fine with precomp headers, but doesn't with precomp headers
and
> > without the static.
> >
> Interesting! MSVC deserves some credit for this!
> 'z' requires storage and it usually prevents generation of precompile
> headers.
>
> BTW, does it work just the same with 'const' instead of 'static'?
>
> Fernando Cacciola


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk