Boost logo

Boost :

From: Jeff Garland (jeff_at_[hidden])
Date: 2003-09-13 08:45:34


On Sat, 13 Sep 2003 03:00:21 -0700 (PDT), Stephan Thomas Lavavej wrote
> lexical_casting a greg_month to a string (or an int, or anything) causes
> a segfault. Hao Huang has identified the problem, but I don't think it's
> been fixed yet.

I believe it has.

>...detail omitted...
>
> (I don't know why MSVC has no problem with this, as someone reported
> when I first pointed out the segfault.)
>
> I think the fix would be to replace
> os << std::setw(2) << std::setfill('0') << m;
> with
> os << std::setw(2) << std::setfill('0') << static_cast<int>(m);
>
> I'm not sure if this is the correct solution, though. I don't even like
> it.

Not prefered. The line of code in question

// old way
else { //default to numeric
  os << std::setw(2) << std::setfill('0') << m;
}

has been modified to

//new way.
else { //default to numeric
  os << std::setw(2) << std::setfill('0') << m.as_number();
}

in the latest CVS.

HTH,

Jeff


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