[ 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 (Tracker Item Submitted) made by marcello-ptr
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: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Marcello Pietrobon (marcello-ptr)
Assigned to: Nobody/Anonymous (nobody)
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



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

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

------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev