bug(?): garbage produced by archive_node.get_string
Pearu Peterson
pearu at cens.ioc.ee
Sat Aug 18 02:11:17 CEST 2001
Hi,
I finally tracked down what caused this garbage.
It was due to
void numeric::archive(archive_node &n) const
in numeric.cpp where a fixed size buffer is defined if HAVE_SSTREAM is
undefined. If I made the following changes
$ diff numeric.cpp numeric.cpp.orig
307c307,308
< std::ostrstream s;
---
> char buf[1024];
> std::ostrstream s(buf, 1024);
329c330,332
< n.add_string("number", s.str());
---
> s << ends;
> std::string str(buf);
> n.add_string("number", str);
then the garbage disappered.
So, why you define fixed size buffer if ostrstream has the same
functionality as ostringstream (at least in gcc system)?
Regards,
Pearu
More information about the GiNaC-devel
mailing list