Boost logo

Boost :

From: Paul A. Bristow (boost_at_[hidden])
Date: 2003-03-27 05:06:48


You are probably right - but the tool tip display shows an __int64 which alerted
me to this. For most purposes, I suspect this warning /Wp64 is not what most
people want.(Or is it Boost policy that code should provide 64-bit portability?
Premature?)

If one writes:

        std::size_t s = 42;
        cout << s << endl;

with MSVC7.0 default project settings for an empty console project on my 32-bit
system

/D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /GF /FD /EHsc /ML /GS /Gy
/Fo"Release/" /Fd"Release/vc70.pdb" /W3 /nologo /c /Wp64 /Zi /TP

it is confusing to get a warning:

test_size_t.cpp(19) : warning C4267: 'argument' : conversion from 'size_t' to
'unsigned int', possible loss of data

(I am unclear why there is a warning unless unsigned int is 32-bit and size_t is
64-bit. How is there a problem if both are 32 or 64?)

If one changes to warning level 4/W4 and no test for 64 portability /Wp64

/D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /GF /FD /EHsc /ML /GS /Gy
/Fo"Release/" /Fd"Release/vc70.pdb" /W4 /nologo /c /Zi /TP

No warnings.

And ideally request 'strict' - no extensions and for scope:

/D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /GF /FD /EHsc /ML /Za
/Zc:forScope
/Fo"Release/" /Fd"Release/vc70.pdb" /W4 /nologo /c /Zi /TP

Still no warnings.

In my experience, carefully written code (which Boost code should be - and
generally is) compiled with MSVC 7.0 and warnings at level 4 produces only a few
warnings, and those can be individually supressed - and should be as a matter of
good documentation.

Paul

PS Despite RTFM, I cannot see how to change the IDE _default_ solution/project
settings. Suggestions?

Paul A Bristow, Prizet Farmhouse, Kendal, Cumbria, LA8 8AB UK
+44 1539 561830 Mobile +44 7714 33 02 04
Mobile mailto:pabristow_at_[hidden]
mailto:pbristow_at_[hidden]

> -----Original Message-----
> From: boost-bounces_at_[hidden]
> [mailto:boost-bounces_at_[hidden]]On Behalf Of Peter Dimov
> Sent: Wednesday, March 26, 2003 1:58 PM
> To: Boost mailing list
> Subject: Re: [boost] VC7/Threads Warnings
>
>
> Paul A. Bristow wrote:
> > I was surprised to find that /Wp64 flag (detect 64-bit portability)
> > means that std::size_t is 64 bit. This leds to a number of oddities
> > that confused me. Is this perhaps causing your problem?
>
> std::size_t is still 32 bit, /Wp64 generates warnings if the meaning of the
> code could have changed had size_t been 64 bit.
>
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
>


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