This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Errors in handling of boost::asio errors ('boost' was compiled with wrong std::string representation?)


John Hein wrote at 10:22 -0700 on Nov 22, 2015:
Use 'size=%zu'.  And get into the habit of compiling with -Wall

1) My apology for inaccuracy.
2) Usually, I use -Wall, but omits it for brevity.
3) GCC cannot warn for "%zu" - "%lu" mismatch. But it can warn if I confuse "%u" with "%s".
4) The problem is still here:

--------------- begin of the code
#include <stdio.h>
#include <boost/asio.hpp>

int main()
{
    boost::asio::ip::address_v4 a;
    boost::system::error_code ec;
    a.from_string("127.0.0.1111", ec);

    std::string s = ec.message();

    printf("size=%zu, c_str=\"%s\".\n",
            s.size(),
            s.c_str());

    return 0;
}
--------------- end of the code

--------------- begin of the output
size=6444086549, c_str="Invalid argument".
--------------- end of the output

Windows 7, 64-bit, russian language.

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]