[ quantlib-Bugs-3588373 ] (with fix) warning C4244: std::ostream::setw() with STLPort

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[ quantlib-Bugs-3588373 ] (with fix) warning C4244: std::ostream::setw() with STLPort

SourceForge.net
Bugs item #3588373, was opened at 2012-11-18 13:55
Message generated for change (Comment added) made by lballabio
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=112740&aid=3588373&group_id=12740

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
>Status: Closed
>Resolution: Fixed
Priority: 5
Private: No
Submitted By: Marcello Pietrobon (marcello-ptr)
>Assigned to: Luigi Ballabio (lballabio)
Summary: (with fix) warning C4244: std::ostream::setw() with STLPort

Initial Comment:
vs2010 with STLPort.5.2.1 and Boost.1_52
XP SP3

error:
ql/math/array.hpp(634): warning C4244: 'argument' : conversion from 'stlpd_std::streamsize' to 'int', possible loss of data
ql/math/array.hpp(635): warning C4244: 'argument' : conversion from 'stlpd_std::streamsize' to 'int', possible loss of data
ql/math/matrix.hpp(584): warning C4244: 'argument' : conversion from 'stlpd_std::streamsize' to 'int', possible loss of data

The fix consists in providing a cast to int because required by STLPort  std::ostream::setw() when compiling with vs2010 (and quite probably all others of versions of Microsoft compilers)

So the fixes are:

ql\math\array.hpp : lines 634, 635
#ifdef _STLPORT_VERSION
            for (Size n=0; n<a.size()-1; ++n)
                out << std::setw((int)width) << a[n] << "; ";
            out << std::setw((int)width) << a.back();
#else
            for (Size n=0; n<a.size()-1; ++n)
                out << std::setw(width) << a[n] << "; ";
            out << std::setw(width) << a.back();
#endif



ql\math\matrix.hpp : lines 584
#ifdef _STLPORT_VERSION
            for (Size j=0; j<m.columns(); j++)
                out << std::setw((int)width) << m[i][j] << " ";
#else
            for (Size j=0; j<m.columns(); j++)
                out << std::setw(width) << m[i][j] << " ";
#endif



----------------------------------------------------------------------

Comment By: Luigi Ballabio (lballabio)
Date: 2012-12-03 05:24

Message:
The patch was applied to the Subversion repository.
Thank you for the report and the fix.


----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=112740&aid=3588373&group_id=12740

------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev