Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2003-04-28 11:48:05

Andreas Huber wrote:
> Hi there
> I compile the following program two times on the newly released MSVC
> 7.1
> #include <boost/shared_ptr.hpp>
> int main()
> {
> boost::shared_ptr< int > p( new int( 0 ) );
> return 0;
> }
> once with each of the following compiler switches:
> 1. /Od /I "..\boost-sandbox" /I "..\boost_1_30_0" /D "WIN32" /D
> "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Gm /EHsc /RTC1 /MTd /Za
> /Zc:wchar_t /Zc:forScope /GR /Fo"Debug/" /Fd"Debug/vc70.pdb" /W3
> /nologo /c /Wp64 /ZI /TP
> 2. /Od /I "..\boost-sandbox" /I "..\boost_1_30_0" /D "WIN32" /D
> "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Gm /EHsc /RTC1 /MTd /Zc:wchar_t
> /Zc:forScope /GR /Fo"Debug/" /Fd"Debug/vc70.pdb" /W3 /nologo /c /Wp64
> /ZI /TP
> I.e. *identical* settings for a _multithreaded_build_, apart from the
> additional /Za (disable language extensions) in 1.
> Now comes the interesting part: The shared_ptr compiled with 1
> _does_not_ contain a mutex while the shared_ptr compiled with 2 does
> contain one!!! I haven't had the time to track down why exactly this
> happens but my guess is that MSVC7.1 is taking the /Za switch very
> seriously and does not define _MT (a non-ANSI macro) in conformant
> mode.

No, the compiler is not at fault, it still defines _MT properly in /Za mode.
The problem is that visualc.hpp defines BOOST_DISABLE_WIN32 when it sees
/Za, and then suffix.hpp defines BOOST_DISABLE_THREADS when it sees
BOOST_DISABLE_WIN32. The end result seems incorrect. I don't know why this
is done or how it should be fixed.

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