1
我的程序在創建ostringstream類的對象時總是崩潰。我無法理解是什麼導致它崩潰?ostringstream對象創建導致我的程序崩潰
計劃:
#include <string>
#include <sstream>
#include <iostream>
DDF foo::send(const DDF& in)
{
ostringstream os; <-- causing crash always
os << in;
string ostr(os.str());
..
}
backtrace of the core
=================
Breakpoint 1, DDF foo::send (this=0x7244f48, [email protected]) at foo.cpp:290
290 DDF foo::send(const DDF& in)
Current language: auto; currently c++
(gdb) n
456 _M_streambuf(0), _M_ctype(0), _M_num_put(0), _M_num_get(0)
(gdb)
Program received signal SIGSEGV, Segmentation fault.
0x00007f897cd7df9c in std::locale::_S_initialize() from /usr/lib64/libstdc++.so.6
(gdb) bt
#0 0x00007f897cd7df9c in std::locale::_S_initialize() from /usr/lib64/libstdc++.so.6
#1 0x00007f897cd7e005 in std::locale::locale() from /usr/lib64/libstdc++.so.6
#2 0x00007f897de70760 in foo::send (this=0x7244f48, [email protected])
at /opt/gcc-4.3.2/lib64/gcc/x86_64-unknown-linux-gnu/4.3.2/../../../../include/c++/4.3.2/bits/basic_ios.h:456