
On page https://svn.boost.org/trac/boost/wiki/Guidelines/MaintenanceGuidelines#warni... it's suggested that the following warning at level 4 can be eliminated with a static cast warning C4244: 'argument' : conversion from <type1> to <type2> possible loss of data I've found this not to be true at least with msvc 7.1 Robert Ramey

https://svn.boost.org/trac/boost/wiki/Guidelines/MaintenanceGuidelines#warni...
With MVSC Microsoft Visual Studio 2008 Version 9.0.21022.8 RTM Microsoft .NET Framework Version 3.5 SP1 if I write long x = 1234567890; short y = x; I get a c4244 warning, but adding static_cast long x = 1234567890; short y = static_cast<short>(x); I don't get a warning (even if I don't get the value I might be expecting ;-) My recollection (dim!) is that 7.1 works the same. Are you quite sure you are casting to the right type? Or is suppressing the line of least resistance (sounds a bit dodgy to me). Paul --- Paul A. Bristow Prizet Farmhouse Kendal, UK LA8 8AB +44 1539 561830, mobile +44 7714330204 pbristow@hetp.u-net.com

2009/11/26 Paul A. Bristow <pbristow@hetp.u-net.com>:
There are a few warning conditions in Visual C++ 7.1 that were removed in later versions. I think their removal is a good indication of their worth (the ones I've come across were certainly buggy). They should probably just be suppressed with something like the following. #if defined(BOOST_MSVC) #pragma warning(push) #if BOOST_MSVC < 1400 #pragma warning(disable:4244) #endif #endif // .... #if defined(BOOST_MSVC) #pragma warning(pop) #endif

If the problem is only with version 7.1, I agree this is the best policy. The https://svn.boost.org/trac/boost/wiki/Guidelines/MaintenanceGuidelines effectively suggest this (but using the BOOST_WORKAROUND macro) " If the warning is only for a specific compiler version, use this approach: #if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) #pragma warning(push) #pragma warning(disable:4512) //assignment operator could not be generated #endif ... #if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) #pragma warning(pop) #endif " Does anyone have a problem with this guidance? Paul --- Paul A. Bristow Prizet Farmhouse Kendal, UK LA8 8AB +44 1539 561830, mobile +44 7714330204 pbristow@hetp.u-net.com

Daniel James wrote:
Hi, what do you think if in addition to setting up the Maintenace Guidelines wiki page we setup some test that proves these gides really work? Best, Vicente -- View this message in context: http://old.nabble.com/warning-policy-issue-tp26532651p26544194.html Sent from the Boost - Dev mailing list archive at Nabble.com.

On Fri, Nov 27, 2009 at 7:51 AM, Vicente Botet Escriba < vicente.botet@wanadoo.fr> wrote:
what do you think if in addition to setting up the Maintenace Guidelines wiki page we setup some test that proves these gides really work?
Great idea. All documentation should have tests. -- Dave Abrahams BoostPro Computing http://www.boostpro.com

Daniel James wrote:
Hi, what do you think if, in addition to setting up the Maintenace Guidelines wiki page, we setup some test that proves these gides really work? Best, Vicente -- View this message in context: http://old.nabble.com/warning-policy-issue-tp26532651p26544206.html Sent from the Boost - Dev mailing list archive at Nabble.com.

what do you think if, in addition to setting up the Maintenace Guidelines wiki page, we setup some test that proves these guides really work?
I'm not clear how you could cover more than the obvious cases. Most of these suggestions I've drawn from actual code examples, giving some sort of assurance that they work. We should also get feedback if they are found deficient - as in the example starting this thread, that gives more assurance. If you are volunteering, be my guest ... ;-) Paul --- Paul A. Bristow Prizet Farmhouse Kendal, UK LA8 8AB +44 1539 561830, mobile +44 7714330204 pbristow@hetp.u-net.com

Paul A. Bristow-2 wrote:
The advantage I see to have tests is that we could be able to see if the guidelines work with new compiler releases. I'll see if I have some spare time to setup these tests. Regards, Vicente -- View this message in context: http://old.nabble.com/warning-policy-issue-tp26532651p26545335.html Sent from the Boost - Dev mailing list archive at Nabble.com.
participants (5)
-
Daniel James
-
Dave Abrahams
-
Paul A. Bristow
-
Robert Ramey
-
Vicente Botet Escriba