Boost logo

Boost :

From: Yitzhak Sapir (ysapir_at_[hidden])
Date: 2002-01-31 10:00:19


Using 'const' works too. It instantiates two different z's as well,
based on results from when I change z.x in the sum functions below to
(int)&z.

-----Original Message-----
From: Fernando Cacciola [mailto:fcacciola_at_[hidden]]
Sent: Thursday, January 31, 2002 4:44 PM
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
Sierra s.r.l.
fcacciola_at_[hidden]
www.gosierra.com

Info: http://www.boost.org Send unsubscribe requests to:
<mailto:boost-unsubscribe_at_[hidden]>

Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/


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