Boost logo

Boost Users :

Subject: [Boost-users] [Lexical Cast] Strange behaviour
From: Robert Jones (robertgbjones_at_[hidden])
Date: 2009-03-17 11:14:50


I know this is not new, but I've just bumped into it....

This code

#include <iostream>
#include <boost/lexical_cast.hpp>

int main(int argc, char* argv[])
{
  try
  {
    ulong u = boost::lexical_cast<ulong>("-1");
    cout<<"Conversion"<
  }
  catch(const std::exception&)
  {
    cout<<"Exception"<
  }
}

Silently returns ULONG_MAX under MSVC7, though not under GCC. It's
an accuate reflection of how the underlying C library handles it, but do we
want
to propogate this strangeness?

Rob.



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net