Boost logo

Boost :

Subject: [boost] [lexical_cast] Strange behaviour
From: Robert Jones (robertgbjones_at_[hidden])
Date: 2009-03-18 12:03:09


Trying again 'cos I mucked up the code last time!

This code

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

int main()
{
  using namespace std;

  try
  {
    unsigned int u=boost::lexical_cast<unsigned int>("-1");
    cout << u << '\n';
  }
  catch(const std::exception&)
  {
    cout << "Exception" << '\n';
  }
}

produces

4294967295

on MSVC7 & 8

rather than an exception. Is it supposed to do this?

Rob.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk