Boost logo

Boost :

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


----- 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
Sierra s.r.l.
fcacciola_at_[hidden]
www.gosierra.com


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